Home  >  Article  >  Database  >  How to exclude the automatic configuration of redis in springboot

How to exclude the automatic configuration of redis in springboot

王林
王林forward
2023-05-26 11:16:052424browse

springboot excludes the automatic configuration of redis

Because a redis link needs to be configured, the system’s own configuration is excluded, which are

RedisAutoConfiguration.class 和 RedisRepositoriesAutoConfiguration.class

two automatic configuration classes

It should be noted that:

RedisRepositoriesAutoConfiguration has a dependency on the bean whose beanName is called "redisTemplate" and needs to be excluded

@SpringBootApplication(exclude={
  RedisAutoConfiguration.class,
  RedisRepositoriesAutoConfiguration.class
})

springboot configuration redis error (red line) Deprecated configuration property "spring.redis.pool.max-active"

The error message is:

Deprecated configuration property 'spring.redis.pool.max-active"

The error configuration is:

#连接池最大连接数(使用负值表示没有限制)
spring.redis.pool.max-active=80
# 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.pool.max-wait=-1
# 连接池中的最大空闲连接
spring.redis.pool.max-idle=20
# 连接池中的最小空闲连接
spring.redis.pool.min-idle=10

Analysis

is because when using jedis, the prefix should be spring.redis.jedis, not spring. redis.

can be changed to the following:

# 连接池最大连接数(使用负值表示没有限制)
spring.redis.jedis.pool.max-active=50
# 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.jedis.pool.max-wait=-1
# 连接池中的最大空闲连接
spring.redis.jedis.pool.max-idle=50
# 连接池中的最小空闲连接
spring.redis.jedis.pool.min-idle=5

The above is the detailed content of How to exclude the automatic configuration of redis in springboot. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete