diff --git a/boot-service/src/main/java/com/xwbing/redis/RedisConfig.java b/boot-service/src/main/java/com/xwbing/redis/RedisConfig.java index 54117b8..cb61f1b 100644 --- a/boot-service/src/main/java/com/xwbing/redis/RedisConfig.java +++ b/boot-service/src/main/java/com/xwbing/redis/RedisConfig.java @@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; @@ -15,19 +16,20 @@ import redis.clients.jedis.JedisPoolConfig; * 作者: xiangwb */ @Configuration +@PropertySource("classpath:redis.properties") public class RedisConfig { private final Logger logger = LoggerFactory.getLogger(RedisConfig.class); - @Value("${redis.maxTotal}") + @Value("${maxTotal}") private Integer maxTotal; - @Value("${redis.maxIdle}") + @Value("${maxIdle}") private Integer maxIdle; - @Value("${redis.minIdle}") + @Value("${minIdle}") private Integer minIdle; - @Value("${redis.host}") + @Value("${host}") private String host; - @Value("${redis.port}") + @Value("${port}") private Integer port; - @Value("${redis.timeout}") + @Value("${timeout}") private Integer timeOut; @Bean diff --git a/boot-service/src/main/resources/redis.properties b/boot-service/src/main/resources/redis.properties index 121d224..368d9dc 100644 --- a/boot-service/src/main/resources/redis.properties +++ b/boot-service/src/main/resources/redis.properties @@ -1,2 +1,13 @@ +host: 192.168.11.202 +port: 6379 +password: +timeout: 10000 +#最大连接数 +maxTotal: 8 +#最大空闲数 +maxIdle: 8 +#最小空闲数 +minIdle: 0 + redisCode=springboot_ systemCode=dataCenter_single \ No newline at end of file diff --git a/boot-web/src/main/resources/application.yml b/boot-web/src/main/resources/application.yml index 8f37ec5..ff65b89 100644 --- a/boot-web/src/main/resources/application.yml +++ b/boot-web/src/main/resources/application.yml @@ -40,21 +40,12 @@ spring: starttls: enable: true required: true - #b编码 + #编码 http: encoding: charset: UTF-8 enabled: true force: true -#redis -redis: - host: 192.168.11.202 - port: 6379 - password: - timeout: 10000 - maxTotal: 8 #最大连接数 - maxIdle: 8 #最大空闲数 - minIdle: 0 #最小空闲数 #log logging: