mardi 24 mars 2015

How to share a property file between several contexts

I use Spring Framework and Spring Security. There are different places where I need to use the page path. For example, "/mainpath". I place it in /WEB-INF/classes/path.properties. The path should be used in servlet-context.xml and in security-context.xml. If the following is placed in both contexts



<context:property-placeholder location="/WEB-INF/classes/path.properties"/>


it will result in



java.lang.IllegalArgumentException: "Could not resolve placeholder 'main.page' in string value "${main.page}"


The following does not give required result.



<context:property-placeholder location="/WEB-INF/classes/path.properties" ignore-unresolvable="true"/>

Aucun commentaire:

Enregistrer un commentaire