Hi all,
I'm bulding a web app packaged in an ear archive.
This ear is targeted to be deployed on several platforms (jetty, tomcat, jonas & weblogic).
My web.xml refers to an applicationContext.xml file.
In this file, I register a PropertyPlaceholderConfigurer bean.
I want to put the property file (registered in the "locations" property of the bean above) outside the ear.
==> I will be able to customize my application depending on each platform settings (URLs of other servers, ....)
My problem is how to define in a generic way the location of my property file.
I found a solution for Application servers based on tomcat (ex : tomcat, jonas)
==>
It works well. But other application servers (like jetty and weblo), the system property ${catalina.base} is not defined.Code:<bean class="org.springframework....PropertyPlaceholderConfigurer"> <property name="locations"> <value>file:${catalina.base}/conf/myappli/myAppli.properties</value> </property>
One solution could be making conditional initialisation in spring beans ?
For instance :
Thanks for your help.Code:< < < if ${catalina.base} is defined ==> use > > > (Tomcat based servers) <bean class="org.springframework....PropertyPlaceholderConfigurer"> <property name="locations"> <value>file:${catalina.base}/conf/myappli/myAppli.properties</value> </property> </bean> < < < else if ${DOMAIN_HOME} is defined ==> use > > > (WEBLOGIC) <bean class="org.springframework....PropertyPlaceholderConfigurer"> <property name="locations"> <value>file:${DOMAIN_HOME}/.../conf/myappli/myAppli.properties</value> </property> </bean> < < < end if > > >
Regards
Guillaume Lundy



Reply With Quote
