求问题验证解决思路
现象所在 version:2.7.15
在2.7.3中使用如下方法注入bean是可以成功的
@Configuration
@RequiredArgsConstructor
@EnableConfigurationProperties({A.class, B.class})
public class DubboBaseAutoConfig implements InitializingBean{
@Bean
@Primary
@ConditionalOnMissingBean(ApplicationConfig.class)
public ApplicationConfig applicationConfig()
然而在2.7.15中会出现这样的错误
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 3 of constructor in com.demo.web.impl.ServiceImpl required a single bean, but 2 were found:
- applicationConfig: defined by method 'applicationConfig' in class path resource [com/demo/starter/dubbo/support/DubboBaseAutoConfig.class]
- org.apache.dubbo.config.ApplicationConfig#0: defined in null
怀疑是提前实例化导致在
org.springframework.context.support.AbstractApplicationContext#finishBeanFactoryInitialization
实例化的时候,存在两个 org.apache.dubbo.config.ApplicationConfig#0
导致的问题
想找个方法验证猜想并解决问题,却没有什么头绪。
2条答案
按热度按时间wb1gzix01#
请问这个问题有解决方吗
mrphzbgm2#
Please try upgrade to 3.1.2