springboot excludes redis auto configuration operations

  • 2021-11-02 01:06:58
  • OfStack

springboot excludes automatic configuration of redis

Because one redis link is to be configured, the configuration that comes with the system is excluded, which are


RedisAutoConfiguration.class  And  RedisRepositoriesAutoConfiguration.class

Two auto-configuration classes

It should be noted that:

RedisRepositoriesAutoConfiguration is dependent on beanName called "redisTemplate" bean, requires 1 and excludes


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

springboot Configuration redis Error Reporting (Red Line Reporting) Deprecated configuration property 'spring. redis. pool. max-active'

The error message is:

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

Error reporting configuration is:


# Maximum number of connections in connection pool (use negative value to indicate no limit) 
spring.redis.pool.max-active=80
#  Maximum blocking wait time of connection pool (use negative value to indicate no limit) 
spring.redis.pool.max-wait=-1
#  Maximum free connection in connection pool 
spring.redis.pool.max-idle=20
#  Minimum free connection in connection pool 
spring.redis.pool.min-idle=10
Analysis

Because in the case of jedis, the prefix should be spring. redis. jedis, not spring. redis.

Replace it with the following:


#  Maximum number of connections in connection pool (use negative value to indicate no limit) 
spring.redis.jedis.pool.max-active=50
#  Maximum blocking wait time of connection pool (use negative value to indicate no limit) 
spring.redis.jedis.pool.max-wait=-1
#  Maximum free connection in connection pool 
spring.redis.jedis.pool.max-idle=50
#  Minimum free connection in connection pool 
spring.redis.jedis.pool.min-idle=5

Related articles: