启动springcloud-zuul 报redis相关的错误,但是这里也并没有用到redis呀

来源:12-2 搭建网关微服务【zuul】

慕神9009311

2021-04-23


APPLICATION FAILED TO START


Description:

Field redisTemplate in com.imooc.utils.RedisOperator required a bean of type ‘org.springframework.data.redis.core.StringRedisTemplate’ that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)

The following candidates were found but could not be injected:
- Bean method ‘stringRedisTemplate’ in ‘RedisAutoConfiguration’ not loaded because auto-configuration ‘RedisAutoConfiguration’ was excluded

Action:

Consider revisiting the entries above or defining a bean of type ‘org.springframework.data.redis.core.StringRedisTemplate’ in your configuration.

写回答

2回答

慕莱坞3126862

2021-06-09

我遇到了类似的问题。原因是我在Application.java里排除了启动时对redis的装配。

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, MongoAutoConfiguration.class, RabbitAutoConfiguration.class, RedisAutoConfiguration.class})

移除

RedisAutoConfiguration.class

然后在yml里面加上

management:
  health:
    redis:
      enabled: false


3
0

风间影月

2021-04-23

pom里有吗。或者依赖的 pom。应该有,有的话会自动装配的

0
0

Spring Cloud 进阶 Alibaba 微服务体系自媒体实战

一课收获分布式系统开发,微服务核心技术和中间件企业生产落地

1113 学习 · 896 问题

查看课程