Repository: struts
Updated Branches:
  refs/heads/master ad3a697d9 -> 1bf7de8d3


WW-4698 Fixes issue with injecting substitutor


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/1bf7de8d
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/1bf7de8d
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/1bf7de8d

Branch: refs/heads/master
Commit: 1bf7de8d3799386ad777080e9bf414c0ba3c5d56
Parents: ad3a697
Author: Lukasz Lenart <lukaszlen...@apache.org>
Authored: Wed Nov 30 10:27:46 2016 +0100
Committer: Lukasz Lenart <lukaszlen...@apache.org>
Committed: Wed Nov 30 10:27:46 2016 +0100

----------------------------------------------------------------------
 .../opensymphony/xwork2/config/impl/DefaultConfiguration.java    | 4 ++++
 .../xwork2/config/providers/EnvsValueSubstitutor.java            | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/1bf7de8d/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
 
b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
index 7426831..08977b2 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
@@ -18,7 +18,9 @@ package com.opensymphony.xwork2.config.impl;
 import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.*;
 import com.opensymphony.xwork2.config.entities.*;
+import com.opensymphony.xwork2.config.providers.EnvsValueSubstitutor;
 import com.opensymphony.xwork2.config.providers.InterceptorBuilder;
+import com.opensymphony.xwork2.config.providers.ValueSubstitutor;
 import com.opensymphony.xwork2.conversion.*;
 import com.opensymphony.xwork2.conversion.impl.*;
 import com.opensymphony.xwork2.factory.*;
@@ -265,6 +267,8 @@ public class DefaultConfiguration implements Configuration {
         builder.factory(PropertyAccessor.class, CompoundRoot.class.getName(), 
CompoundRootAccessor.class, Scope.SINGLETON);
         builder.factory(OgnlUtil.class, Scope.SINGLETON);
 
+        builder.factory(ValueSubstitutor.class, EnvsValueSubstitutor.class, 
Scope.SINGLETON);
+
         builder.constant(XWorkConstants.DEV_MODE, "false");
         builder.constant(XWorkConstants.LOG_MISSING_PROPERTIES, "false");
         builder.constant(XWorkConstants.ENABLE_OGNL_EVAL_EXPRESSION, "false");

http://git-wip-us.apache.org/repos/asf/struts/blob/1bf7de8d/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
 
b/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
index 1c21a63..b4b1086 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
@@ -27,14 +27,14 @@ public class EnvsValueSubstitutor implements 
ValueSubstitutor {
 
     public EnvsValueSubstitutor() {
         strSubstitutor = new StrSubstitutor(System.getenv());
-        strSubstitutor.setVariablePrefix("${ENV.");
+        strSubstitutor.setVariablePrefix("${env.");
         strSubstitutor.setVariableSuffix('}');
         strSubstitutor.setValueDelimiter(":");
     }
 
     @Override
     public String substitute(String value) {
-        LOG.debug("Substituting value {} with proper ENV value", value);
+        LOG.debug("Substituting value {} with proper System variable or 
environment variable", value);
 
         String substituted = StrSubstitutor.replaceSystemProperties(value);
         return strSubstitutor.replace(substituted);

Reply via email to