Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-microservice-exam
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
汪想
spring-microservice-exam
Commits
3ea8a693
Commit
3ea8a693
authored
Mar 31, 2019
by
tangyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复Redis配置失效bug
parent
29540ce8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
22 deletions
+10
-22
pom.xml
common/common-core/pom.xml
+0
-10
RedisConfig.java
...ava/com/github/tangyi/common/core/config/RedisConfig.java
+6
-8
auth-service.yml
config-service/src/main/resources/config/auth-service.yml
+1
-1
exam-service.yml
config-service/src/main/resources/config/exam-service.yml
+1
-1
gateway-service.yml
config-service/src/main/resources/config/gateway-service.yml
+1
-1
user-service.yml
config-service/src/main/resources/config/user-service.yml
+1
-1
No files found.
common/common-core/pom.xml
View file @
3ea8a693
...
...
@@ -94,16 +94,6 @@
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
<exclusions>
<exclusion>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
</dependency>
<!-- 配置属性加密工具 -->
<dependency>
...
...
common/common-core/src/main/java/com/github/tangyi/common/core/config/RedisConfig.java
View file @
3ea8a693
...
...
@@ -3,7 +3,7 @@ package com.github.tangyi.common.core.config;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.
jedis.J
edisConnectionFactory
;
import
org.springframework.data.redis.connection.
R
edisConnectionFactory
;
import
org.springframework.data.redis.core.*
;
import
org.springframework.data.redis.serializer.JdkSerializationRedisSerializer
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
...
...
@@ -19,18 +19,16 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
public
class
RedisConfig
{
@Bean
public
JedisConnectionFactory
jedisConnectionFactory
()
{
return
new
JedisConnectionFactory
();
}
@Bean
public
RedisTemplate
<
String
,
Object
>
redisTemplate
()
{
public
RedisTemplate
<
String
,
Object
>
redisTemplate
(
RedisConnectionFactory
redisConnectionFactory
)
{
RedisTemplate
<
String
,
Object
>
redisTemplate
=
new
RedisTemplate
<>();
// 存储对象需要配置序列化机制
redisTemplate
.
setKeySerializer
(
new
StringRedisSerializer
());
redisTemplate
.
setHashKeySerializer
(
new
StringRedisSerializer
());
redisTemplate
.
setValueSerializer
(
new
JdkSerializationRedisSerializer
());
redisTemplate
.
setHashValueSerializer
(
new
JdkSerializationRedisSerializer
());
redisTemplate
.
setConnectionFactory
(
jedisConnectionFactory
());
// 开启事务
redisTemplate
.
setEnableTransactionSupport
(
true
);
redisTemplate
.
setConnectionFactory
(
redisConnectionFactory
);
return
redisTemplate
;
}
...
...
config-service/src/main/resources/config/auth-service.yml
View file @
3ea8a693
...
...
@@ -8,7 +8,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.jdbc.Driver
redis
:
host
:
${REDIS_HOST:
localhost
}
host
:
${REDIS_HOST:
192.168.0.213
}
port
:
${REDIS_PORT:6379}
rabbitmq
:
host
:
${RABBIT_HOST:localhost}
...
...
config-service/src/main/resources/config/exam-service.yml
View file @
3ea8a693
...
...
@@ -8,7 +8,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.jdbc.Driver
redis
:
host
:
${REDIS_HOST:
localhost
}
host
:
${REDIS_HOST:
192.168.0.213
}
port
:
${REDIS_PORT:6379}
rabbitmq
:
host
:
${RABBIT_HOST:localhost}
...
...
config-service/src/main/resources/config/gateway-service.yml
View file @
3ea8a693
...
...
@@ -2,7 +2,7 @@ server:
port
:
8000
spring
:
redis
:
host
:
${REDIS_HOST:
localhost
}
host
:
${REDIS_HOST:
192.168.0.213
}
port
:
${REDIS_PORT:6379}
boot
:
admin
:
...
...
config-service/src/main/resources/config/user-service.yml
View file @
3ea8a693
...
...
@@ -8,7 +8,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.jdbc.Driver
redis
:
host
:
${REDIS_HOST:
localhost
}
host
:
${REDIS_HOST:
192.168.0.213
}
port
:
${REDIS_PORT:6379}
rabbitmq
:
host
:
${RABBIT_HOST:localhost}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment