You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2017/03/14 18:36:00 UTC

[07/24] struts git commit: Moves default bean name to common place

Moves default bean name to common place


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

Branch: refs/heads/master
Commit: 524343c3cf79faad15e49fc26221de308853cbfc
Parents: 2733f15
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 8 17:45:32 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 8 17:45:32 2017 +0100

----------------------------------------------------------------------
 .../opensymphony/xwork2/config/impl/DefaultConfiguration.java | 4 +++-
 .../apache/struts2/config/AbstractBeanSelectionProvider.java  | 7 +++----
 .../main/java/org/apache/struts2/dispatcher/Dispatcher.java   | 3 ++-
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/524343c3/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 31bf283..9830d92 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
@@ -51,6 +51,8 @@ import java.util.*;
  */
 public class DefaultConfiguration implements Configuration {
 
+    public static final String DEFAULT_BEAN_NAME = "struts";
+
     protected static final Logger LOG = LogManager.getLogger(DefaultConfiguration.class);
 
 
@@ -66,7 +68,7 @@ public class DefaultConfiguration implements Configuration {
     ObjectFactory objectFactory;
 
     public DefaultConfiguration() {
-        this("xwork");
+        this(DEFAULT_BEAN_NAME);
     }
 
     public DefaultConfiguration(String defaultBeanName) {

http://git-wip-us.apache.org/repos/asf/struts/blob/524343c3/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
index 34e340b..f0c691f 100644
--- a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
+++ b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
@@ -4,6 +4,7 @@ import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.BeanSelectionProvider;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.inject.*;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
@@ -19,8 +20,6 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
 
     private static final Logger LOG = LogManager.getLogger(AbstractBeanSelectionProvider.class);
 
-    public static final String DEFAULT_BEAN_NAME = "struts";
-
     public void destroy() {
         // NO-OP
     }
@@ -43,7 +42,7 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
 
     protected void alias(Class type, String key, ContainerBuilder builder, Properties props, Scope scope) {
         if (!builder.contains(type)) {
-            String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
+            String foundName = props.getProperty(key, DefaultConfiguration.DEFAULT_BEAN_NAME);
             if (builder.contains(type, foundName)) {
                 LOG.trace("Choosing bean ({}) for ({})", foundName, type.getName());
                 builder.alias(type, foundName, Container.DEFAULT_NAME);
@@ -55,7 +54,7 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
                 } catch (ClassNotFoundException ex) {
                     // Perhaps a spring bean id, so we'll delegate to the object factory at runtime
                     LOG.trace("Choosing bean ({}) for ({}) to be loaded from the ObjectFactory", foundName, type.getName());
-                    if (DEFAULT_BEAN_NAME.equals(foundName)) {
+                    if (DefaultConfiguration.DEFAULT_BEAN_NAME.equals(foundName)) {
                         // Probably an optional bean, will ignore
                     } else {
                         if (ObjectFactory.class != type) {

http://git-wip-us.apache.org/repos/asf/struts/blob/524343c3/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index 226ecfc..d0431f4 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -26,6 +26,7 @@ import com.opensymphony.xwork2.config.*;
 import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
@@ -463,7 +464,7 @@ public class Dispatcher {
     public void init() {
 
     	if (configurationManager == null) {
-    		configurationManager = createConfigurationManager(DefaultBeanSelectionProvider.DEFAULT_BEAN_NAME);
+    		configurationManager = createConfigurationManager(DefaultConfiguration.DEFAULT_BEAN_NAME);
     	}
 
         try {