From: <fg...@us...> - 2011-08-12 09:04:11
|
Revision: 3610 http://openutils.svn.sourceforge.net/openutils/?rev=3610&view=rev Author: fgiust Date: 2011-08-12 09:04:05 +0000 (Fri, 12 Aug 2011) Log Message: ----------- DEPLOY-9 Accept also system properties in the file location. Modified Paths: -------------- trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java Modified: trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java =================================================================== --- trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java 2011-08-12 08:58:23 UTC (rev 3609) +++ trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java 2011-08-12 09:04:05 UTC (rev 3610) @@ -31,7 +31,9 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Map.Entry; import java.util.Properties; +import java.util.Set; import javax.servlet.ServletContext; @@ -48,6 +50,7 @@ import org.springframework.context.ApplicationContextAware; import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; +import org.springframework.util.CollectionUtils; import org.springframework.util.ResourceUtils; import org.springframework.util.StringValueResolver; import org.springframework.web.context.WebApplicationContext; @@ -65,6 +68,7 @@ * <li>the server name: ${env}</li> * <li>the web application root folder name (only for web contexts): ${appl}</li> * <li>any web context init parameter (only for web contexts): ${contextParam/paramname}</li> + * <li>any system property: ${systemProperty/paramname}</li> * </ul> * <p> * <p> @@ -194,6 +198,18 @@ } } + Set<Entry<Object, Object>> entrySet = System.getProperties().entrySet(); + if (!CollectionUtils.isEmpty(entrySet)) + { + Iterator<Entry<Object, Object>> properties = entrySet.iterator(); + while (properties.hasNext()) + { + Entry<Object, Object> entry = properties.next(); + String propName = (String) entry.getKey(); + initParametersMap.put("${systemProperty/" + propName + "}", (String) entry.getValue()); + } + } + String hostname = null; try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |