diff --git a/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java b/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java index feadf747..57d229ec 100644 --- a/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java +++ b/core/src/main/java/org/springframework/ws/client/core/WebServiceTemplate.java @@ -42,6 +42,7 @@ import org.springframework.ws.client.WebServiceTransformerException; import org.springframework.ws.client.WebServiceTransportException; import org.springframework.ws.client.support.WebServiceAccessor; import org.springframework.ws.soap.client.core.SoapFaultMessageResolver; +import org.springframework.ws.support.DefaultStrategiesHelper; import org.springframework.ws.support.MarshallingUtils; import org.springframework.ws.transport.FaultAwareWebServiceConnection; import org.springframework.ws.transport.TransportException; @@ -51,7 +52,6 @@ import org.springframework.ws.transport.context.DefaultTransportContext; import org.springframework.ws.transport.context.TransportContext; import org.springframework.ws.transport.context.TransportContextHolder; import org.springframework.ws.transport.http.HttpUrlConnectionMessageSender; -import org.springframework.ws.transport.support.DefaultStrategiesHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/core/src/main/java/org/springframework/ws/server/MessageDispatcher.java b/core/src/main/java/org/springframework/ws/server/MessageDispatcher.java index 86506b4d..2ea475dc 100644 --- a/core/src/main/java/org/springframework/ws/server/MessageDispatcher.java +++ b/core/src/main/java/org/springframework/ws/server/MessageDispatcher.java @@ -45,8 +45,8 @@ import org.springframework.ws.server.endpoint.adapter.MessageMethodEndpointAdapt import org.springframework.ws.server.endpoint.adapter.PayloadEndpointAdapter; import org.springframework.ws.server.endpoint.adapter.PayloadMethodEndpointAdapter; import org.springframework.ws.soap.server.SoapMessageDispatcher; +import org.springframework.ws.support.DefaultStrategiesHelper; import org.springframework.ws.transport.WebServiceMessageReceiver; -import org.springframework.ws.transport.support.DefaultStrategiesHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/core/src/main/java/org/springframework/ws/transport/support/DefaultStrategiesHelper.java b/core/src/main/java/org/springframework/ws/support/DefaultStrategiesHelper.java similarity index 96% rename from core/src/main/java/org/springframework/ws/transport/support/DefaultStrategiesHelper.java rename to core/src/main/java/org/springframework/ws/support/DefaultStrategiesHelper.java index 67bbc489..8ce5949e 100644 --- a/core/src/main/java/org/springframework/ws/transport/support/DefaultStrategiesHelper.java +++ b/core/src/main/java/org/springframework/ws/support/DefaultStrategiesHelper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.ws.transport.support; +package org.springframework.ws.support; import java.io.IOException; import java.io.InputStream; @@ -26,6 +26,7 @@ import javax.servlet.ServletContext; import org.springframework.beans.BeanUtils; import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; @@ -111,7 +112,7 @@ public class DefaultStrategiesHelper { throws BeanInitializationException { String key = strategyInterface.getName(); try { - List result = null; + List result; String value = defaultStrategies.getProperty(key); if (value != null) { String[] classNames = StringUtils.commaDelimitedListToStringArray(value); @@ -142,6 +143,9 @@ public class DefaultStrategiesHelper { beanNameAware.setBeanName(clazz.getName()); } if (applicationContext != null) { + if (strategy instanceof BeanClassLoaderAware) { + ((BeanClassLoaderAware) strategy).setBeanClassLoader(applicationContext.getClassLoader()); + } if (strategy instanceof BeanFactoryAware) { ((BeanFactoryAware) strategy).setBeanFactory(applicationContext); } diff --git a/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java b/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java index 81d2bbe7..8c7bd8a4 100644 --- a/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java +++ b/core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java @@ -36,8 +36,8 @@ import org.springframework.ws.server.EndpointAdapter; import org.springframework.ws.server.EndpointExceptionResolver; import org.springframework.ws.server.EndpointMapping; import org.springframework.ws.server.MessageDispatcher; +import org.springframework.ws.support.DefaultStrategiesHelper; import org.springframework.ws.transport.WebServiceMessageReceiver; -import org.springframework.ws.transport.support.DefaultStrategiesHelper; import org.springframework.ws.wsdl.WsdlDefinition; /** diff --git a/core/src/test/java/org/springframework/ws/transport/support/DefaultStrategiesHelperTest.java b/core/src/test/java/org/springframework/ws/support/DefaultStrategiesHelperTest.java similarity index 99% rename from core/src/test/java/org/springframework/ws/transport/support/DefaultStrategiesHelperTest.java rename to core/src/test/java/org/springframework/ws/support/DefaultStrategiesHelperTest.java index e30ec9fd..d216e724 100644 --- a/core/src/test/java/org/springframework/ws/transport/support/DefaultStrategiesHelperTest.java +++ b/core/src/test/java/org/springframework/ws/support/DefaultStrategiesHelperTest.java @@ -14,12 +14,11 @@ * limitations under the License. */ -package org.springframework.ws.transport.support; +package org.springframework.ws.support; import java.util.List; import java.util.Properties; -import junit.framework.TestCase; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanInitializationException; import org.springframework.context.ApplicationContext; @@ -28,6 +27,8 @@ import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import junit.framework.TestCase; + public class DefaultStrategiesHelperTest extends TestCase { public void testGetDefaultStrategies() throws Exception { diff --git a/core/src/test/resources/org/springframework/ws/support/strategies.properties b/core/src/test/resources/org/springframework/ws/support/strategies.properties new file mode 100644 index 00000000..6c8dbbbe --- /dev/null +++ b/core/src/test/resources/org/springframework/ws/support/strategies.properties @@ -0,0 +1 @@ +org.springframework.ws.support.DefaultStrategiesHelperTest$Strategy=org.springframework.ws.support.DefaultStrategiesHelperTest$StrategyImpl,org.springframework.ws.support.DefaultStrategiesHelperTest$ContextAwareStrategyImpl diff --git a/core/src/test/resources/org/springframework/ws/transport/support/strategies.properties b/core/src/test/resources/org/springframework/ws/transport/support/strategies.properties deleted file mode 100644 index 7c89373a..00000000 --- a/core/src/test/resources/org/springframework/ws/transport/support/strategies.properties +++ /dev/null @@ -1 +0,0 @@ -org.springframework.ws.transport.support.DefaultStrategiesHelperTest$Strategy=org.springframework.ws.transport.support.DefaultStrategiesHelperTest$StrategyImpl,org.springframework.ws.transport.support.DefaultStrategiesHelperTest$ContextAwareStrategyImpl