Build-time property configuration
Build-time property configuration
Build-time Spring configuration is performed in module.properties. At run-time, Spring resolves the placeholders in the Spring XML configuration files against the values in module.properties.
Note:
Only one <context:property-placeholder> is allowed for all Spring XML configuration files.
Setting values in non-Spring configuration files
You may need to set property values in your project's non-Spring configuration files, such as log4j.properties or security.xml. You can set those values at build time by changing the values in the appropriate configuration file located in the misc or security directory in <WAR Extension Project root>\src\main\webapp\WEB-INF.
If you are adding a new non-spring configuration file, do the following:
- Create the new configuration file and place it in <WAR Extension Project root>\src\main\webapp\WEB-INF
- Open the extension project's pom.xml
- Under all <maven-war-plugin> tags, add a new <resource> in the <webResources> element. For example, to add a security.xml at build-time, the <resource> would look similar to the following:
<plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <directory>src/main/webapp</directory> <filtering>true</filtering> <includes> <include>WEB-INF/security.xml</include> </includes> </resource> </webResources> </configuration> ... </plugin>
- <directory> is the directory in your extension project that contains the configuration file(s) to be copied at build-time.
- <filtering> specifies whether to replace property value placeholders in the configuration file(s) with values in module.properties.
- <targetPath> is the directory relative to the WAR root where the configuration file(s) will be copied during the build.
- <includes> or <excludes> can be used to filter which files are copied. If neither are present, all files in the source directory are copied.