当前位置:   article > 正文

Spring Boot(四十七):自动装配之Condition_no bean named 'redistemplate' available

no bean named 'redistemplate' available

Condition是在Spring 4.0 增加的条件判断功能,通过这个可以功能可以实现选择性的创建 Bean操作。

思考:

SpringBoot是如何知道要创建哪个Bean的?比如SpringBoot是如何知道要创建RedisTemplate的?

看一个例子:

当我们没导入redis-start时,会报错

引出问题

  1. Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'redisTemplate' available
  2. at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:874)
  3. at org.springframework.bea
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/53954
推荐阅读
相关标签
  

闽ICP备14008679号