加上这个配置后,就会报错。单个数据源测试好用。
数据源A和B创建都没问题。
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamicDataSource' defined in class path resource [SpringContext.xml]: Cannot resolve reference to bean 'dataSourceA' while setting bean property 'targetDataSources' with key [TypedStringValue: value [dataSourceA], target type [class java.lang.String]]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dataSourceA' is defined
在网上找的spring+hibernate配置多动态数据源的例子,地址:http://blog.csdn.net/kindazrael/article/details/7285336,很多都是用这种方式。为什么我添加dynamicDataSource
标签后就创建不了实例呢?