0
我有一个datasource.xml如下。因为有些查询依赖于数据库,所以我有两个用于mySql和Oracle的sql bean文件,至于mysql中的限制等同于oracle.rownum中的限制,我从oracle文件夹或mysql文件夹中导入资源文件。现在,我必须在构建之前更改导入语句。有没有其他方法可以在属性文件中使用数据库名称.PropertyConfigurer至少在Spring 3.0.5中不适用于import语句。在Spring bean文件中参数化导入资源
<import resource="classpath:oracle/SqlBeans.xml" />
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" >
<value>${ds-jndi}</value>
</property>
<property name="lookupOnStartup" value="false" />
<property name="cache" value="true" />
<property name="proxyInterface" value="javax.sql.DataSource" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
看看Spring Profiles(例如http://blog.chariotsolutions.com/2012/01/spring-31-cool-new-features.html),但它是Spring 3.1 – 2012-04-26 05:14:55