-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
enhancementImprove a feature or add a new featureImprove a feature or add a new feature
Description
I'm trying to get a dynamic datasource on mybatis.
while i use @RefreshScope on dao interface,an exception will occur.
the code is :
ClassPathMapperScanner ,line:196
beacuse it war RootBeanDefinition,not GenericBeanDefinition .
i can only fix it by change the source code on MapperScannerConfigurer :
ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry) {
@Override
public Set<BeanDefinitionHolder> doScan(String... basePackages) {
Set<BeanDefinitionHolder> beanDefinitions = super.doScan(basePackages);
if (!beanDefinitions.isEmpty()) {
for (BeanDefinitionHolder beanDefinitionHolder : beanDefinitions) {
// set scope
beanDefinitionHolder.getBeanDefinition().setScope("refresh");
}
}
return beanDefinitions;
}
};
Metadata
Metadata
Assignees
Labels
enhancementImprove a feature or add a new featureImprove a feature or add a new feature