在应用中,需要热切换数据源。但发现如下问题:
在应用中,需要热切换数据源。但发现如下问题:
错误
Java代码
1. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'swappable' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is null
2. java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'swappable' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is null
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
配置如下
Java代码
1. <bean id="myDataSource1" value="${jdbc.driverClassName}"/>
3. <property name="url" value="${jdbc.url1}"/>
4. <property name="username" value="${jdbc.username}"/>
5. <property name="password" value="${jdbc.password}"/>
6. </bean>
<bean id="dataSource1" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url1}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
用应用服务器的JNDI就会出现上面的错误。请指教。谢谢。