lundi 29 novembre 2010

Externaliser la configuration de ses webapp

Dans les webapps utilisant spring il est possible d'externaliser sa configuration à l'aide de variables d'environnement pour log4j :

<bean id="log4jConfigurer"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass">
<value>org.springframework.util.Log4jConfigurer</value>
</property>
<property name="targetMethod">
<value>initLogging</value>
</property>
<property name="arguments">
<list>
<value>${MYREP_CONF}/log4j.xml</value>
<!-- or you could use an absolute path: <value>file:D:\\etc\\myapp\\log4j.properties</value> -->
</list>
</property>
</bean>

Aucun commentaire: