Atomikos Forum |
|
Hi am currently using Atomikos for XA transactions for my application based on Spring. Am new to both Spring and also Atomikos. Am trying to configure multiple datasources, however, i want the connection details to be picked from property file.
My Current Configuration <bean id="datasource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <property name="xaProperties"> <props> <prop key="user">${jdbc.username}</prop> <prop key="password">${jdbc.password}</prop> <prop key="URL">${jdbc.url}</prop> </props> </property> </bean> now how can these placeholders be referenced ? How will the property file be referenced for the properties (jbdc.username, jdbc.url, jdbc.password) ? Can i have some sample example or code snippted for this. Thanks in advance. Shindhur
Hi,
Have a look at the PropertyPlaceholderConfigurer in Spring. See http://www.codejava.net/frameworks/spring/reading-properties-files-in-spring-with-propertyplaceholderconfigurer-bean for an example. HTH
Hi Guy Pardon,
Thanks a lot for your reply. But in my case, its the nested properties that are to be read. Does your post hold good even in case of reading nested properties? <bean id="datasource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <property name="xaProperties"> <props> <prop key="user">${jdbc.username}</prop> Does the ${jdbc.username} nested under user under xaProperties be read correctly ?
Also, the actual requirement is we have a proprietary application, whose startup script would use -D to override the properties from property file placed in config location.
Is there a way we can override the above properties, during application startup with properties from external file. -DOverrideFile="TestFile.prop" |