也就是在这个Java类里面的注入的接口需要一个Bean实现,
Parameter 1 of constructor in com.abc.auth.controller.TokenController required a bean of type 'org.springframework.cache.CacheManager' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'cacheManager' in 'CaffeineCacheConfiguration' not loaded because @ConditionalOnClass did not find required class 'com.github.benmanes.caffeine.cache.Caffeine'
- Bean method 'cacheManager' in 'EhCacheCacheConfiguration' not loaded because @ConditionalOnClass did not find required class 'net.sf.ehcache.Cache'
- Bean method 'cacheManager' in 'JCacheCacheConfiguration' not loaded because @ConditionalOnClass did not find required class 'javax.cache.Caching'
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.cache.CacheManager' in your configuration.
@RequiredArgsConstructor
public class TokenController {
@Autowired
private TokenStore tokenStore;
// private RedisTemplate redisTemplate;
// private CacheManager cacheManager;
@Autowired
private final RedisTemplate redisTemplate;
private final CacheManager cacheManager;
没有找到cacheManager的实现
cacheManager被final
修饰符修饰
@RequiredArgsConstructor的意思是:
Lombok注解 | 释义 |
---|---|
@RequiredArgsConstructor | 生成包含常量、标识了NotNull的变量的构造方法。生成的构造方法是私有的private |
@NoArgsConstructor | 生成无参的构造方法 |
@AllArgsContructor | 生成包含所有属性的构造器 |
1) 去掉final、去掉@RequiredArgsConstructor注解。重启