Redis Spring Bean Conflict
APPLICATION FAILED TO START
Description:
Parameter 0 of method authStateCache in com.xkcoding.justauth.autoconfigure.JustAuthStateCacheConfiguration$Redis required a single bean, but 2 were found: - justAuthRedisCacheTemplate: defined by method 'justAuthRedisCacheTemplate' in class path resource [com/xkcoding/justauth/autoconfigure/JustAuthStateCacheConfiguration$Redis.class] - stringRedisTemplate: defined by method 'stringRedisTemplate' in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.class]
This may be due to missing parameter name information
Action:
Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
Ensure that your compiler is configured to use the '-parameters' flag. You may need to update both your build tool settings as well as your IDE. (See https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#parameter-name-retention)
缓存类型设置为自定义,然后再定义一个 AuthStateCache Bean 即可
@Bean
public AuthStateCache authStateCache(RedisTemplate<String, String> redisTemplate, JustAuthProperties justAuthProperties) {
return new RedisStateCache(redisTemplate, justAuthProperties.getCache());
}