springboot注入Redistemplate报错

1、springboot使用版本

    2.0.1.RELEASE
    
        org.springframework.boot
        spring-boot-starter-parent
        2.0.1.RELEASE
        
    

2、报错原因

    使用@Autowired注解

    @Autowired
    private RedisTemplate redisTemplate;

3、解决方法

    使用@Resource注解

    @Resource
    private RedisTemplate redisTemplate;

你可能感兴趣的:(springboot)