RedisTemplate依赖报错

No qualifying bean of type [RedisTemplate] found for dependency

maven项目启动抛异常,登录页面能够正常打开,但是验证码的图片不显示。
异常:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.data.redis.core.RedisTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:457)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:435)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:559)
	at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
	... 36 more

启动本地的项目以后,打开的登录页面不能显示验证码。先声明一下,博主的项目是一个分布式项目,运行dubbo的时候,控制台没有提示异常,能够正常启动,在运行Tomcat项目时,报了如上错误,怀疑是RedisTemplate造成的。

在网上百度了很多,有些大佬说的是因为注解错误了:

@AutoWired
private RedisTemplate redisTemplate;

就是要把@Autowired注解改成@Resource.但是博主的注解就是@Resource,不知道是什么原因造成的,不知道哪位大神可以解答一下,欢迎留言!感激不尽!

session id = c7b29dee-c5e9-4f33-aef8-c77b2d7a1b00
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
getNode:/ADMIN_SESSIONS/c7b29dee-c5e9-4f33-aef8-c77b2d7a1b00
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
admin-->Mon Nov 12 17:54:40 CST 2018-->/sys/login/vcimage.htmlx

你可能感兴趣的:(IDEA项目启动)