Spring 3.1.2 Unified Property Management issues.
Using Spring 3.1.2.RELEASE and the http://blog.springsource.org/2011/02...ty-management/ and other common 3+ posting I have have implemented the following:
A Spring Integration project that contains int-context.xml integration objects that have no properties
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/integration/jdbc
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
<context:component-scan base-package="com.verizon.optima.reterm"/>
<int:channel id="splitterChannel" />
<int-jdbc:inbound-channel-adapter channel="splitterChannel"
data-source="dbDataSource"
.
.
.
.
db-context.xml which contains properties.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:property-placeholder location="classpath:app.properties"/>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
id="transactionManager">
<property ref="dbDataSource" name="dataSource"/>
</bean>
<bean id="dbDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${db.driverClassName}" />
<property name="JdbcUrl" value="${db.url}" />
<property name="user" value="${db.username}" />
<property name="password" value="${db.password}" />
</bean>
.
.
.
.
The main method:
Code:
public static void man(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"int-context.xml"});
}
All of the Property placeholder values from the app.properties are found in the local.properties. All properties referenced with the @Value("dbSchema") private String dbSchema or obtaining them from the @Autowired private Environment env; object are not found. Debugging the Environment object, it only contains System.properties and Environment properties as stated in the Blog. However, you cannot get the property sources from the ClassPathXmlApplicationContext so I can't add my own PropertySource.
Any help would be appreciated and I am sorry if I didn't fully exhaust the search results to find the 3.1.2 way of accessing properties.