New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mybatis-spring-2.0.5 MapperScannerConfigurer 导致brcc多次加载 #12
Comments
sdk中添加加载标志,当第一次加载成功后加载标志设置为true,后面加不再加载 |
现象:
引入mybatis-spring-boot-starter 2.1.3 (对应mybatis-spring 2.0.5)后, 在多数据源情况下sdk多次加载brcc配置。
问题分析:
项目中多数据源情况下, 通过@MapperScan指定扫描不同的package和sqlSessionFactory, @MapperScan -> @import(MapperScannerRegistrar.class) -> MapperScannerConfigurer
MapperScannerConfigurer 实现了BeanDefinitionRegistryPostProcessor接口, 在配置processPropertyPlaceHolders为true的情况下会调用processPropertyPlaceHolders()方法
`
private void processPropertyPlaceHolders() {
// 获取到brcc的ConfigCenterPropertyPlaceholderConfigurer
Map<String, PropertyResourceConfigurer> prcs = applicationContext.getBeansOfType(PropertyResourceConfigurer.class,
false, false);
}
`
这样导致了brcc多次远程调用
The text was updated successfully, but these errors were encountered: