You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parameter 1 of method sessionRepositoryFilterRegistration in org.springframework.boot.autoconfigure.session.SessionRepositoryFilterConfiguration required a single bean, but 2 were found:
- redisCacheConnectionFactory: defined by method 'redisCacheConnectionFactory' in class path resource [com/cwg/test/config/CacheConfig.class]
- redisSessionConnectionFactory: defined by method 'redisSessionConnectionFactory' in class path resource [com/cwg/test/config/RedisConfig.class]
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
Three actions are suggested:
marking one of the beans as @Primary
updating the consumer to accept multiple beans
using @Qualifier to identify the bean that should be consumed
One can be taken as redisCacheConnectionFactory and redisSessionConnectionFactory are both defined by the user. Two isn't possible as the consumer is code in org.springframework.boot that a user cannot change. A variation of 3 is possible as the injection point (which the analysis identifies incorrectly) uses @SpringSessionRedisConnectionFactory. Adding @SpringSessionRedisConnectionFactory to the user's @Bean definition fixes the problem.
I wonder if we can improve the failure analysis to only suggest actions that are (likely to be) possible, or to at least refine the wording a little to explain when each is likely to be possible.
The text was updated successfully, but these errors were encountered:
wilkinsona
changed the title
Failure analysis of a dependency injection failures suggests actions that can't be taken
Failure analysis of a dependency injection failure suggests actions that can't be taken
Jun 23, 2022
See #31510 for background.
Consider the following failure analysis:
Three actions are suggested:
@Primary
@Qualifier
to identify the bean that should be consumedOne can be taken as
redisCacheConnectionFactory
andredisSessionConnectionFactory
are both defined by the user. Two isn't possible as the consumer is code inorg.springframework.boot
that a user cannot change. A variation of 3 is possible as the injection point (which the analysis identifies incorrectly) uses@SpringSessionRedisConnectionFactory
. Adding@SpringSessionRedisConnectionFactory
to the user's@Bean
definition fixes the problem.I wonder if we can improve the failure analysis to only suggest actions that are (likely to be) possible, or to at least refine the wording a little to explain when each is likely to be possible.
The text was updated successfully, but these errors were encountered: