dev/java(egov)
Bean 중 하나를 @Primary로 표시하거나, 여러 Bean을 허용하도록 소비자를 업데이트하거나, 소비해야 하는 Bean을 식별하기 위해 @Qualifier를 사용하는 것을 고려하세요.
strange-dev
2024. 12. 25. 17:04
반응형
에러 발생
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
프로젝트에서 'getUserConnection' Bean이 충돌하여 발생.
인텔리제이에서는 발생을 하지 않았고 이클립스에서만 발생을 했었습니다.
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in --------------------------- required a single bean, but 3 were found:
- getUserConnection: defined by method 'getUserConnection' in class path resource [-------------/RedisConfig.class]
- getSessionConnection: defined by method 'getSessionConnection' in class path resource [-------------/RedisConfig.class]
- getSseConnection: defined by method 'getSseConnection' in class path resource [-------------/RedisConfig.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)
기존 소스
@Bean
@Qualifier("getUserConnection")
public RedisTemplate<String, Object> getUserConnection()
@Bean
@Qualifier("getSessionConnection")
public RedisTemplate<String, Object> getSessionConnection()
변경 소스
@Bean
@Qualifier("getUserConnection")
public RedisTemplate<String, Object> getUserConnection()
@Bean
@Qualifier("getSessionConnection")
@Primary << 추가
public RedisTemplate<String, Object> getSessionConnection()
반응형