springboot 配置RedisTemplate 报:Field redisTemplate in XXX required a bean of type 'org.springframework

错误信息如下:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-09-09 14:16:09.385 ERROR 10464 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Field redisTemplate in com.jr.service.planokr.utils.RedisUtil required a bean of type 'org.springframework.data.redis.core.RedisTemplate' that could not be found.

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


Action:

Consider defining a bean of type 'org.springframework.data.redis.core.RedisTemplate' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:51021', transport: 'socket'

Process finished with exit code 1


如果你的jar引入,并且版本对的话,

检查你的用法:

  @Autowired
    private RedisTemplate redisTemplate;

改为:

  @Autowired
    private RedisTemplate  redisTemplate;

 

你可能感兴趣的:(spring框架,springboot,spring,源码分析)