Home> Database> Redis> body text

How to exclude the automatic configuration of redis in springboot

王林
Release: 2023-05-26 11:16:05
forward
2401 people have browsed it

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
Copy after login

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 })
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!