spring-boot-data-source-decorator
spring-boot-data-source-decorator copied to clipboard
DataSourceNameResolver does not work as expected
When using multiple datasource they all get the same name "dataSource".
You cannot get the bean name from applicationContext.getBeansOfType(DataSource.class) because they haven't finished initializing. So the returned map will never contain the bean you are decorating. You should pass the bean name via a parameter in the resolveDataSourceName method.