I've got a strange problem which I think is Spring related. I'm developing a Maven multi module application structured as follow:
DataModule (includes generale Hibernate entities and daos)
ServiceModule (includes specific Hibernate entities and daos) - depends on DataModule
Web (gwt web module) - depends on ServiceModule
In DataModule I've a classic Spring-Hibernate xml configuration, consisting of (relevant code):
ApplicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans ..>
<!-- Auto scan the components -->
<context:annotation-config />
<context:component-scan base-package="com.x.dataModule" >
<context:include-filter type="regex"
expression="com.x.dataModule.dao.*" />
</context:component-scan>
<!-- Import resources -->
<import resource="applicationContext-hibernate.xml" />
<import resource="applicationContext-dataSource.xml" />
</beans>
applicationContext-hibernate.xml
<beans ..>
<bean id="defaultLobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" />
<!-- Hibernate session factory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean ">
<property name="packagesToScan" value="com.x.dataModel.model.**.*"></property>
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="lobHandler" ref="defaultLobHandler" />
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.query.substitutions">true 1, false 0</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.charSet">UTF8</prop>
</props>
</property>
</bean>
<!-- Transaction Manager -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
</beans>
Hibernate.cfg is actually empty, since I aim to avoid explicit mapping due the use of packagesToScan property. applicationContext-dataSource is not relevant since it contains ds configuration.
The ServiceModule relies on the previous module.
applicationContext.xml
<beans ...>
<!-- Auto scan the components -->
<context:include-filter type="regex"
expression="com.x.serviceModule.dao.*" />
<context:include-filter type="regex"
expression="com.x.serviceModule.manager.*" />
<!-- Import resources -->
<context:property-override location="classpath:override.properties"/>
<import resource="classpath*:/applicationContext-hibernate.xml" />
<import resource="classpath*:/applicationContext-dataSource.xml" />
</beans>
The file override.properties contains the following entry, to modify the definition of packagesToScan
sessionFactory.packagesToScan=com.x.*.model.**.*
At this point everything works just fine. The serviceManagers (singletons) are loaded from the factory as
ApplicationContext appContext = new ClassPathXmlApplicationContext(
"applicationContext.xml").getBean(..);
And everything is behaving as expected.
Last part, the Web Module. If I import the ServiceModule and test it as a Java application, again everything is fine. However, if I start the module as a web application, it fails complaining that it's not able to load entities/daos defined in the DataModule.
Relevant files in Web Module:
WEB-INF/spring
applicationContext.xml: nothing here other than the import of applicationContext-security.xml (residing in the same directory)
web.xml
<!-- Spring context -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
WEB-INF/spring/applicationContext.xml
</param-value>
</context-param>
<!-- Creates the Spring Container -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
The only way to avoid the problem is to declare explicitly the entities mapping and daos definition in the DataModule xml files.
My question: is there a way to avoid such declarations, and rely entirely on the component/package scan also in Web Module?
I'm not really sure but looks like that somehow the spring web context is conflicting with my other spring context. Otherwise, I don't understand why everything is fine as Java application, but fails as web.
Also (not sure if relevant) it seems that the Session Factory bean is istantiated twice during the process (shouldn't it be a singleton?).
Spring version is 3.1.1 Release, Hibernate 3.6.0 Final (4.0.1 for commons-annotations). Tomcat 7 for deploy.
I didn't provide the Java code of entities/daos/managers since I don't think it's relevant for the question; however, I can provide it if it's of any help. Thanks a lot
Related
I have a spring-hibernate feature built as a separate jar (Collection.jar) for use by multiple webapps. This collection.jar has a spring-config.xml where beans are defined. When this jar is included in a webapp (spring-application1), the classes defined in collection.jar are not getting auto-wired.
spring-config.xml from Collection.jar
<context:annotation-config/>
<context:component-scan base-package="com.antk.pkg" />
<import resource="spring-datasource.xml" />
<bean id="delegator" class="com.antk.pkg.Delegator">
<property name="dbUtils" ref="dbUtils" />
</bean>
<bean id="dbUtils" class="com.antk.pkg.util.DBUtils">
<property name="dao" ref="collectorDao" />
</bean>
<bean id="collector" class="com.antk.pkg.Collector">
<property name="collectorService" ref="collectorServiceImpl" />
</bean>
<bean id="collectorServiceImpl" class="com.antk.pkg.service.CollectorService">
<property name="collectorDao" ref="collectorDaoImpl" />
<property name="delegator" ref="delegator" />
</bean>
...
and in spring-application1, I am including the above as :
<bean id="com.antk.pkg.collector.spring"
class="org.springframework.context.support.ClassPathXmlApplicationContext" abstract="false"
scope="prototype" lazy-init="default" autowire="default">
<constructor-arg>
<list>
<value>spring-config.xml</value>
</list>
</constructor-arg>
</bean>
But when I call collector, collectorservice is being set as null all the time. Its not getting autowired. Any thoughts.
Assuming your spring-config.xml to be present in your classpath.
Put below in your web.xml -
1) Specify which spring config files to load
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring-config.xml</param-value>
</context-param>
2) Define the ContextLoaderListener :-
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Also there is a problem while loading spring-config.xml files from jar.
" Resource implementation supports resolution as java.io.File if the class path resource resides in the file system, but not for classpath resources which reside in a jar and have not been expanded (by the servlet engine, or whatever the environment is) to the filesystem." http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html
Avoid relying on classpath resource loader while loading config.xml files from jar.
Well, very likely there isn't any mystery but I am just not smart enough to figure out what my problem is. However usually it is the mystery after all!
Sorry for the introduction, my problem is that the prototype scope doesn't seem to work for me. I have created a REST service with a Spring Integration flow (there is a http inbound gateway in the front of the flow). The scopes of most of the beans are prototype. I tested the flow by calling it ten times with threads. Also I logged the bean references (just print the 'this' in the object being called) and I saw the same reference ten times!
e.g. org.protneut.server.common.utils.XmlToMapConverter#755d7bc2
To my knowledge it means that no new instance is being created for the XmlToMapConverter but using the same instance ten times. Am I right?
Very likely I configured the Spring incorrectly but I just cannot find out what I missed.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/SpringIntegration-servlet.xml</param-value>
</context-param>
<servlet>
<servlet-name>SpringIntegration</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringIntegration</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
SpringIntegration-servlet.xml
<beans ...>
<mvc:annotation-driven/>
<context:component-scan base-package="org.protneut.server.controller, org.protneut.server.common.persistence.service" />
<jpa:repositories base-package="org.protneut.server.common.persistence.repository"/>
<!-- ********************* importing the mysql config ********************* -->
<import resource="/mysql-config-context.xml"/>
<!-- ********************* importing the message flow ********************* -->
<import resource="classpath:META-INF/spring/integration/processing_req_wokflow.xml"/>
<tx:annotation-driven />
<!-- ************************************************************************* -->
<!-- ******************************** for JPA ******************************** -->
<!-- ************************************************************************* -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="org.protneut.server.common.persistence.model" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/>
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<!-- ********************* the used property files ********************* -->
<context:property-placeholder location="classpath:protneut-server-config.properties"/>
<!--
****************************************************************************************
********************** Beans used in the Spring Integration flow **********************
****************************************************************************************
-->
<!-- it has to be prototype, it cannot be request as it is in an async call so it is not in the request! -->
<bean id="logManager" class="org.protneut.server.log.LogManager" scope="prototype"></bean>
<bean id="convertRestToWorkflowBean" class="org.protneut.server.rest.ConvertRestMessageToWorkflowBean" scope="prototype"/>
<bean id="xmlToMapConverter" class="org.protneut.server.common.utils.XmlToMapConverter" scope="prototype"/>
<bean id="serviceStorageManager" class="org.protneut.server.cache.ServiceStorageManager" scope="singleton">
<property name="cacheBeanDAO" ref="cacheBeanDAO"/>
</bean>
<bean id="serviceCall" class="org.protneut.server.call.ServiceCall" scope="prototype">
<property name="httpClient" ref="httpClient"/>
</bean>
<bean id="xmlResponseExtractor" class="org.protneut.server.extract.XmlResponseExtractor" scope="prototype">
<property name="xmlToMapConverter" ref="xmlToMapConverter"/>
</bean>
...
</beans>
flow configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans ..>
<task:executor id="async_executor" pool-size="50" />
<!-- ***************************************************************************************************** -->
<!-- ************************************* WORKFLOW STARTING ********************************************* -->
<!-- ***************************************************************************************************** -->
<int-http:inbound-gateway id="receivingRest-inboundGateway"
supported-methods="POST" path="/service/get"
request-payload-type="java.lang.String" reply-timeout="10000"
request-channel="arrivedRestReq_channel" auto-startup="true"
error-channel="error_channel" reply-channel="restResponse-channel" >
</int-http:inbound-gateway>
<int:channel id="arrivedRestReq_channel" scope="prototype"></int:channel>
<int:json-to-object-transformer type="java.util.Map"
input-channel="arrivedRestReq_channel"
output-channel="fromConvertToActivator-channel"
id="convertJsonToMap_">
</int:json-to-object-transformer>
<int:channel id="fromConvertToActivator-channel"></int:channel>
<int:service-activator
input-channel="fromConvertToActivator-channel"
output-channel="toCallChain-channel"
id="convertRestToWorkflowBean-serviceActivator"
ref="convertRestToWorkflowBean" method="convert">
</int:service-activator>
<int:channel id="toCallChain-channel"></int:channel>
<int:chain input-channel="toCallChain-channel" id="call_chain">
<int:service-activator
id="serviceStorageManager-serviceActivator"
ref="serviceStorageManager" method="getServiceInfo">
</int:service-activator>
<int:service-activator id="serviceRequestCreator-serviceActivator" ref="serviceRequestCreator" method="create"/>
<int:service-activator id="call-serviceActivator"
ref="serviceCall" method="call">
</int:service-activator>
<int:router expression="payload.extractType.name()"
id="responseExtractor-router">
<int:mapping value="XPATH" channel="xmlResponse-channel"/>
<int:mapping value="JSONPATH" channel="jsonResponse-channel"/>
</int:router>
</int:chain>
...
<int:service-activator id="xmlResponseExtractor-serviceActivator"
ref="xmlResponseExtractor" method="extract" input-channel="xmlResponse-channel" output-channel="toRestResponseCreator_chain"></int:service-activator>
</beans>
So I defined the scope of XmlToMapConverter is prototype but still I can't have new object at a new request. The situation is the same for convertRestToWorkflowBean which is the first service call in the flow (service-activator).
Could you please explain to me where the problem is?
Thanks, V.
I don't see xmlToMapConverter usage, but I see this:
<int:service-activator
input-channel="fromConvertToActivator-channel"
output-channel="toCallChain-channel"
id="convertRestToWorkflowBean-serviceActivator"
ref="convertRestToWorkflowBean" method="convert">
where you use this:
<bean id="convertRestToWorkflowBean" class="org.protneut.server.rest.ConvertRestMessageToWorkflowBean" scope="prototype"/>
The issue you are facing is called scope impendance. That's because <int:service-activator> populates several singleton beans, hence the reference to your prototype becomes as singleton, too.
One way to overcome that to use SpEL from there:
<int:service-activator
input-channel="fromConvertToActivator-channel"
output-channel="toCallChain-channel"
id="convertRestToWorkflowBean-serviceActivator"
expression="#convertRestToWorkflowBean.convert(payload)"/>
In this case your convertRestToWorkflowBean is retrieved from the BeanFactory on each call.
Another trick to go ahead looks like:
<bean id="convertRestToWorkflowBean" class="org.protneut.server.rest.ConvertRestMessageToWorkflowBean" scope="prototype">
<aop:scoped-proxy/>
</bean>
In this case your bean will be wrapped to the ScopedProxyFactoryBean and all invocation will be delegated to your prototype on demand.
Prototype scoped beans will be created every time you call ApplicationContext.getBean(...)
You've included the bean definition but haven't shown how other services reference it. My guess is it's injected into a singleton service once during initialization hence there's only one. Perhaps you need to call ApplicationContext.getBean() each time to get a new instance.
There are other solutions involving dynamic proxies that ultimately invoke getBean(), I'm on my mobile at the moment so too hard to find a link for you.
I am working on a project where we decided to add some interaction using jms and hornetq as provider.
I am quite new to Camel so I ran into a problem some if you may refer as trivial.
The goal was to initialize connection factory and add the jms component. However, as I understand it can't be done directly in the route configurator. So I created camel-config.xml and placed it to the resources/ directory.
I filled it in the following way:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
<prop key="java.naming.provider.url">jnp://localhost:1099</prop>
<prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>ConnectionFactory</value>
</property>
</bean>
<bean name="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsQueueConnectionFactory"/>
</bean>
</beans>
The project doesn't use Spring so it was the only example of the xml I have found that doesn't make use of Spring.
In the route configurator I use routeBuilder.from("jms:queue:top").to("...");
However, when I start the project it throws FailedToCreateEndpointException and states
"No component found with schema: jms".
I suppose that the xml file is simply not used but I just can't understand how to point to it.
Looking forward to hearing any advice.
The <beans/> XML is a Spring configuration that has to be bootstrapped in some way. You may have a look at the Tomcat ActiveMQ example found here, showing how to do that in a servlet environment. Have a special look at web.xml:
<!-- location of spring XML files -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:broker.xml,
classpath:camel-config.xml
</param-value>
</context-param>
<!-- the listener that kick-starts Spring, which loads the XML files and start our application -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Of course, you could also use a Java only setup as follows:
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
ModelCamelContext context = new DefaultCamelContext();
context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
I have three xml files in my spring hibernate app
Spring-Security.xml
<security:authentication-manager>
<security:authentication-provider user-service-ref="customUserDetailsService">
</security:authentication-provider>
</security:authentication-manager>
<!-- Use a Md5 encoder since the user's passwords are stored as Md5 in the database -->
<bean class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" id="passwordEncoder"/>
<!-- A custom service where Spring will retrieve users and their corresponding access levels -->
<bean id="customUserDetailsService" class="com.vaannila.service.CustomUserDetailsService" >
</bean>
hibernate-context.xml
enter code here
<!-- Declare a datasource that has pooling capabilities-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close"
p:driverClass="${app.jdbc.driverClassName}"
p:jdbcUrl="${app.jdbc.url}"
p:user="${app.jdbc.username}"
p:password="${app.jdbc.password}"
p:acquireIncrement="5"
p:idleConnectionTestPeriod="60"
p:maxPoolSize="100"
p:maxStatements="50"
p:minPoolSize="10" />
<!-- Declare a transaction manager-->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
p:sessionFactory-ref="sessionFactory" />
<bean id="registrationDAO" class="com.vaannila.dao.RegistrationDAOimpl" >
<constructor-arg ref="sessionFactory"/>
</bean>
Now in my spring security i want something like
<bean id="customUserDetailsService" class="com.vaannila.service.CustomUserDetailsService" >
<constructor-arg ref="registrationDAO"/>
</bean
but my registrationDAO is in hibernate-config and when i do that in spring Security it says no bean named registration DAO
Spring supports reading application context across external jars. Simply add "classpath:" prefix to the context file name. Spring will look for it in the whole project.
For instance, if you are creating web application, you might declare your business logic application context like this (web.xml)
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext.xml <!-- tell Spring to look for context defined on the classpath -->
</param-value>
</context-param>
That way You'll be able to use as many context, as necessary.
In web.xml I have the following:
<servlet>
<description>JAX-WS endpoint - EARM</description>
<display-name>jaxws-servlet</display-name>
<servlet-name>jaxws-servlet</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jaxws-servlet</servlet-name>
<url-pattern>/webServices/*</url-pattern>
</servlet-mapping>
In my application context I have the following definitions:
<bean id="helloService" class="com.foo.HelloServiceImpl">
<property name="regularService" ref="regularService" />
</bean>
<wss:binding url="/webServices/helloService" service="#helloService" />
I get a NullPointerException when trying to access the WSDL:
java.lang.NullPointerException
at com.sun.xml.ws.transport.http.HttpAdapter.<init>(HttpAdapter.java:145)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.<init>(ServletAdapter.java:76)
at com.sun.xml.ws.transport.http.servlet.ServletAdapterList.createHttpAdapter(ServletAdapterList.java:5 0)
at com.sun.xml.ws.transport.http.servlet.ServletAdapterList.createHttpAdapter(ServletAdapterList.java:4 7)
at com.sun.xml.ws.transport.http.HttpAdapterList.createAdapter(HttpAdapterList.java:73)
at com.sun.xml.ws.transport.http.servlet.SpringBinding.create(SpringBinding.java:24)
at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.init(WSSpringServlet.java:46)
Strange ... appears to be a configuration error but the darn thing just dies with a NullPointerException!!!!!!!! No logging is provided.
Deployed in Resin.
UPDATE: I finally figured out the real answer to this problem and posted
it here:
http://forum.springsource.org/showthread.php?p=286701
In short, Resin 3x ships with an
XSD-unaware parser and you have to
replace it with Apache Xerces or some
other parser (see above forum post).
=========================
The following bean definitions get the Spring JAX-WS working (without using the "stupid" xbean / namespace magic). To come by this, I had to read the source and figure out the correct classes to use - sometimes by intentionally providing a property value that I knew would cause an exception (such as an invalid Class - this allowed me to see the stack trace which lead back to the bean class).
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="webServiceMethodInterceptor"
class="com.webservice.util.interceptors.WebServiceMethodInterceptor">
<property name="userId" value="hello" />
<property name="password" value="world" />
<property name="roles" value="ROLE_ANONYMOUS,ROLE_MICKEY_MOUSE" />
</bean>
<bean id="webServiceLoggingInterceptor"
class="com.webservice.util.interceptors.LoggingInterceptor">
<property name="level" value="debug" />
</bean>
<bean id="webServiceExceptionTranslator"
class="com.webservice.util.interceptors.WebServiceExceptionTranslator"/>
<!-- The list of interceptors to apply to all web methods -->
<bean id="webServiceInterceptors" class="java.util.LinkedList">
<constructor-arg index="0">
<list>
<value>webServiceExceptionTranslator</value>
<value>webServiceLoggingInterceptor</value>
<value>webServiceMethodInterceptor</value>
</list>
</constructor-arg>
</bean>
<!-- Proxied ExampleWebService -->
<bean id="exampleWebService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="com.webservice.ExampleWebServiceImpl">
<!-- TODO: add dependencies for web service here, for example:
<property name="someService" ref="someService" />
-->
</bean>
</property>
<property name="interceptorNames" ref="webServiceInterceptors" />
<property name="proxyTargetClass" value="true" />
</bean>
<!-- JAX-WS Endpoint for ExampleWebService -->
<bean class="com.sun.xml.ws.transport.http.servlet.SpringBinding">
<property name="url" value="/webServices/exampleService" />
<property name="service">
<bean class="org.jvnet.jax_ws_commons.spring.SpringService">
<property name="bean">
<ref local="exampleWebService" />
</property>
<property name="impl"
value="com.webservice.ExampleWebServiceImpl" />
</bean>
</property>
</bean>
Everything else is as in the tutorial linked to above (you add the JAX-WS Spring servlet in web.xml, add the servlet filter so that web service requests get routed to the jaxws servlet).
The key to using the proxied web service instance (thus enabling dependency injection, AOP, etc.) was setting proxyTargetClass="true" to force a CGLIB proxy instead of a JDK dynamic proxy (which requires an interface). JAX-WS seems to not like interfaces for some reason.
I hope this helps some one!
Regards,
LES
LES2: Your implementation seem most complex.
What's wrong with simple usage of SpringBeanAutowiringSupport, as described in Spring manual