How do I autowire my webservices client in my WAR application (using Spring)? - spring

I’m using Maven 3.0.3, CXF 2.7.15, and Spring 3.2.11.RELEASE. Using the JAX-WS Maven plugin, web service client classes are auto-generated (plugin code below) ...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlDirectory>${basedir}/src/wsdl</wsdlDirectory>
<sourceDestDir>${basedir}/src/main/java</sourceDestDir>
<packageName>org.collegeboard.bsorg</packageName>
</configuration>
</execution>
</executions>
</plugin>
which include the below
package org.myproject.bsorg;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.3-b02-
* Generated source version: 2.1
*
*/
#WebService(name = "OrganizationWebService", targetNamespace = "http://mainco.org/bsorg/")
#XmlSeeAlso({
ObjectFactory.class
})
public interface OrganizationWebService {
Then I have my own service class, in which I try and reference the above through auto wiring …
package org.mainco.subco.myproject.service;
#Service("orgWsdlSvc")
public class OrgWsdlServiceImpl implements OrgWsdlService
{
#Autowired
private OrganizationWebService m_ows;
When I deploy my WAR file, I get the error
09:20:17,846 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-14) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orgWsdlSvc': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.mainco.bsorg.OrganizationWebService org.mainco.subco.myproject.service.OrgWsdlServiceImpl.m_ows; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.mainco.bsorg.OrganizationWebService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:290) [spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1148) [spring-beans-3.2.11.RELEASE.jar:3.2.11.RELEASE]
But I’m confused about how to properly autowire things in my web.xml and accompanying context files. In my WEB-INF/web.xml, I have
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/META-INF/spring/applicationContext-myproject.xml,
classpath:/META-INF/spring/infrastructure.xml
</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>myproject.webapp</param-value>
</context-param>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
In my WEB-INF/dispatcher-servlet.xml file I have
<!-- Enable annotation driven controllers, validation etc... -->
<mvc:annotation-driven />
<context:component-scan base-package="org.mainco" />
<!-- Define spring bean for use with this app. -->
<bean id="localPropertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:application.properties</value>
</property>
</bean>
<!-- Define application properties for use in Spring classes -->
<util:properties id="applicationProperties" location="classpath:application.properties" />
<tx:annotation-driven />
and in my “applicationContext-myproject.xml”, I have
<util:properties id="applicationProperties" location="classpath:application.properties" />
<util:properties id="coreProperties" location="classpath:core.properties" />
<context:component-scan base-package="org.mainco.subco" />
<context:component-scan base-package="org.mainco.bsorg" />
<bean id="sessionTimeoutInSeconds" class="java.lang.Long">
<constructor-arg>
<value>3600</value>
</constructor-arg>
</bean>
<!-- Enable annotation driven controllers, validation etc... -->
<mvc:annotation-driven />
<!-- Define spring bean for use with this app. -->
<bean id="localPropertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:application.properties</value>
</property>
</bean>
<bean id="assert" class="org.mainco.subco.util.Assert" factory-method="createInstance" />
<http-conf:conduit name="https://.*">
<http-conf:tlsClientParameters secureSocketProtocol="TLSv1" disableCNCheck="true">
<sec:trustManagers>
<sec:keyStore type="JKS" password="${key.store.password}" resource="${key.store.file}" />
</sec:trustManagers>
<sec:keyManagers keyPassword="${key.manager.password}">
<sec:keyStore type="pkcs12" password="${private.key.password}" resource="${private.key.file}" />
</sec:keyManagers>
</http-conf:tlsClientParameters>
</http-conf:conduit>
<jaxws:client id="orgWebServiceClient"
serviceClass="org.mainco.bsorg.OrganizationWebService"
address="${wsdl.url}"
/>
<bean id="organizationWebService" class="org.mainco.bsorg.OrganizationWebService"></bean>
What do I need to do so I can autowire my web services client?
Edit: Per the suggestion given, I added the bean definition to my application context (see above) file, but received the following error upon deplyohing the application:
Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orgWsdlSvc': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.myproject.bsorg.OrganizationWebService org.mainco.subco.myproject.service.OrgWsdlServiceImpl.m_ows;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'organizationWebService' defined in class path resource [META-INF/spring/applicationContext-myproject-mvc.xml]: Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.mainco.bsorg.OrganizationWebService]: Specified class is an interface

You are missing the bean definition in your applicationContext-myproject.xml.
<!-- Definition for OrganizationWebService bean -->
<bean id="organizationWebService" class="org.mainco.bsorg.OrganizationWebService"></bean>
See this for more examples:
http://www.mkyong.com/spring/spring-auto-wiring-beans-with-autowired-annotation/
EDIT:
You are making progress. Now spring is able to find the autowired candidate in the application context.
However, there is another problem, the candidate is an interface and spring is not able to instantiate it (neither does javac). So, you need to create a class to implement your interface and describe it in your application context (instead or describing an interface). So; you need to create a org.mainco.bsorg.OrganizationWebServiceImp class implementing org.mainco.bsorg.OrganizationWebService and change your application context to:
<bean id="organizationWebService" class="org.mainco.bsorg.OrganizationWebServiceImp"></bean>
More info here: Could not instantiate bean class: Specified class is an interface
EDIT2:
Look at https://jax-ws.java.net/2.2.1/docs/UsersGuide.html#3.1.2_Starting_from_a_WSDL_File
The documentation clarifies that:
Generate a service endpoint interface.
Implement the service endpoint interface.
Create a WAR file to deploy.
You need to implement the service endpoint interface with a concrete class eg: OrganizationWebServiceImp

Related

Spring 4.2.4 - Autowire stopped working in RAD WAS 8.5 once Java 8 was installed

The application was running fine in WAS 8.5 for several years, including local WAS8.5 server in RAD. Installed Java 8 on laptop, recompiled code in RAD under JDK 1.7 (only on installed), restarted server and got below error on start up:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'addressController': Injection of
autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private
com.components.mds.service.StaticReferenceService
com.mds.ui.controller.MDSBaseController.staticRefService;
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type
[com.components.mds.service.StaticReferenceService] found
for dependency: expected at least 1 bean which qualifies as autowire
candidate for this dependency. Dependency annotations:
{#org.springframework.beans.factory.annotation.Autowired(required=true)}
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
The application has ear with presentation (jsps, controllers, etc) and jar with services, DAO, etc. The jar is included in the lib folder of the ear. In the ear (war), the controller has following code:
#Controller
#SessionAttributes({MDS_PRESCRIBER_ADDRESS_MAP , MDS_PRESCRIBER})
public class AddressController extends MDSBaseController {
private String editAddressID;
private AddressModel addressPhoneModel = new AddressModel();
#Autowired
AddressValidations addressValidator;
and has spring-context.xml with following:
<context:spring-configured />
<context:component-scan base-package="com.caremark.mds.ui.customtag"></context:component-scan>
<context:load-time-weaver aspectj-weaving="on" />
The above will try to autowire class in jar:
#Component
public class AddressValidator {
public boolean validatePrescriberAddress(Address address){
...
}
with spring-component-context.xml that specifies beans:
<!-- Bean defined in JAR -->
<context:component-scan base-package=" com.components.mds.service" />
<context:component-scan base-package=" com.components.mds.business" />
<context:component-scan base-package=" com.components.mds.validation" />
<context:component-scan base-package=" com.components.mds.dao" />
<context:component-scan base-package=" com.components.mds.auth.service" />
<context:component-scan base-package=" com.components.mds.auth.dao" />
<context:component-scan base-package=" com.components.mds.audit.service" />
<context:component-scan base-package=" com.components.mds.audit.dao" />
<context:component-scan base-package=" com.components.mds.audit.vo" />
<!-- DO not declare beans here just use annotations in class file -->
<mvc:annotation-driven />
The Static Reference class is also annotated:
#Service
public class StaticReferenceServiceImpl implements StaticReferenceService {
//SLF4J Log handler
private static final Logger log = LoggerFactory.getLogger(StaticReferenceServiceImpl.class);
#Autowired
private StaticReferenceDao staticRefDao;
#Autowired
private MDSEhCacheManager<StaticReference,Map<String,ReferenceDataVO>> cacheManager;
It looks like class from the war cannot see the class in the jar that is in the lib folder of the war under WEB-INF\lib
Any suggestions why it would stop working if the only change is laptop upgrade to use Java 8
The error log is showing that it is not able to inject private com.components.mds.service.StaticReferenceService defined in com.mds.ui.controller.MDSBaseController.staticRefService you should check StaticReferenceService whether it is annotated with any of the Spring annotation like component, service

why autowired variable in prototype scope works only in the first instance

I am trying to Autowired RestTemplate and I am using the suggestion from why can I autowire or inject pojo but I can't autowire or inject RestTemplate . Unfortunetlly I am facing a problem from the second instantiation. The variable restTemplate works only once. After that, it is null. I guess that I might have done some mistake in dispatcher-servlet or web.xml config.
I know that the scope prototype creates a new instance every time it is called but I wasn't expect the auto wired RestTemplate to be null in the second instance. All others autowired variables runs perfectly every calls.
I saw some similiar threads and all of them ends up with some solution related to create a scope proxy. I changed to #Scope(value="prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) but I got the error "Can only specify arguments for the getBean method when referring to a prototype bean definition". Honestly I can't imagine this as the right direction for my case as I have problem only with restTemplate and in the second evoke of context.getBean.
//the process starts here
ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
display = context.getBean(Lo_DisplayHandler.class, request, response);
display.lastPage();
DisplayHandler
#Component
#Scope("prototype")
public class Lo_DisplayHandler extends Lo_Handler {
//this constructor runs twice when the application start
public Lo_DisplayHandler() {
super();
}
this constructor runs every time the bean is get from context (context.getBean(Lo_DisplayHandler.class, request, response)). The first time Lo_DisplayHandler is created restTemplate is filled in but from the second time forward restTemplate is null
public Lo_DisplayHandler(HttpServletRequest request,HttpServletResponse response) {
super();
//get DB2 connection and set some data in session
}
#Autowired
private RestTemplate restTemplate;
//restTemplate will exist only in the first time
LogDisplay _l = restTemplate.postForObject(RestProperties.getUrl() + RestProperties.getFirstpage(),_mas60010, LogDisplay.class);
mvc-dispatcher-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" 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.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:annotation-config />
<mvc:annotation-driven />
<context:component-scan base-package="com.myCompany.mhe.common.controller, com.myCompany.mhe.log.handler, com.myCompany.mhe.utilities, com.myCompany.mhe.log.domain, com.myCompany.mhe.log.storedprocedure" />
<context:property-placeholder location="classpath:restServices.properties"/>
<mvc:resources mapping="/**" location="/" />
<!—-
If take the next three beans definition from here to applicationContext.xml and change contextConfigLocation to point to applicationContext.xml instead of mvc-dispatcher-servlet.xml my controller stops to work
-->
<bean id="jacksonObjectMapper" class="com.fasterxml.jackson.databind.ObjectMapper" />
<bean
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="jacksonObjectMapper" />
<property name="targetMethod" value="configure" />
<property name="arguments">
<list>
<value type="com.fasterxml.jackson.databind.DeserializationFeature">READ_DATE_TIMESTAMPS_AS_NANOSECONDS</value>
<value>true</value>
</list>
</property>
</bean>
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper" ref="jacksonObjectMapper" />
</bean>
</list>
</property>
</bean>
</beans>
web.xml
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
//Exception after default constructor removed
[WARNING ] Exception encountered during context initialization - cancelling refresh attempt
Error creating bean with name 'lo_Controller': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mycompany.mhe.Mhe_Handler com.mycompany.mhe.common.controller.Lo_Controller.mhe_Handler; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lo_DisplayHandler' defined in file [C:\STS\wsRestTemplate\MHE_original\WebContent\WEB-INF\classes\com\mycompany\mhe\log\handler\Lo_DisplayHandler.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mycompany.mhe.log.handler.Lo_DisplayHandler]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.mycompany.mhe.log.handler.Lo_DisplayHandler.<init>()
[ERROR ] Context initialization failed
Error creating bean with name 'lo_Controller': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mycompany.mhe.Mhe_Handler com.mycompany.mhe.common.controller.Lo_Controller.mhe_Handler; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lo_DisplayHandler' defined in file [C:\STS\wsRestTemplate\MHE_original\WebContent\WEB-INF\classes\com\mycompany\mhe\log\handler\Lo_DisplayHandler.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mycompany.mhe.log.handler.Lo_DisplayHandler]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.mycompany.mhe.log.handler.Lo_DisplayHandler.<init>()

byName Annotation based Autowiring (Spring3)

I am trying to create spring-mvc project.
My "Repository" component is defined as
#Repository("testEntityDao")
public class TestEntityDaoImpl extends GenericDaoImpl<TestEntity> implements TestEntityDao {
"Service" component with instance of TestEntityDao
#Service("testManager")
public class TestManagerServiceImpl implements TestManagerService{
#Autowired
TestEntityDao testEntityDao;
TestManagerServiceImpl doesn't have any constructor defined and it also doesn't have getter and setter for testEntityDao. (I tried code after writing setter, but got same error).
ApplicationContext.xml has following line to enable autowiring byName
<beans xmlns="http://www.springframework.org/schema/beans"
.
.
default-autowire="byName">
<context:annotation-config />
<context:component-scan
base-package= .... />
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:ApplicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Error that I am getting is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.test.cms.dao.TestEntityDao com.test.cms.service.impl.TestManagerServiceImpl.testEntityDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.test.cms.dao.TestEntityDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true), #org.springframework.beans.factory.annotation.Qualifier(value=testEntityDao)}
How to resolve this error ?
Just refer to common parent package instead of all these packages. Make your component scan as:
<context:component-scan base-package="com.test.cms"/>

Spring bean profile reference

I started using bean profile for conditional bean creation, but When i use the profiled bean outside of profile with ref I get exception nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'pb' is defined
<bean id="q" class="com.Q"> //spring can not create this bean since it depends on `pb` bean which is profiled.
<property name="p" ref="pb"/>
</bean>
<beans profile="a">
<bean id="pb" class="com.T"/>
</beans>
<beans profile="b">
<bean id="pb" class="com.T"/>
</beans>
How can I achieve this? I am sure a profile is on:
System.setProperty(AbstractEnvironment.DEFAULT_PROFILES_PROPERTY_NAME, "a");
System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, "a");

Autowiring request scoped beans into application scoped beans

Is it possible to autowire a request scoped bean into an application scoped bean. i.e
I have a class RequestScopedBean:
class RequestScopedBean {
....
....
....
}
and a class Application scoped bean in which the request scoped bean is autowired.
class ApplicationScopedBean {
#Autowire
private RequestScopedBean requestScopedBean;
....
....
....
}
and the spring-config xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
">
<bean id="applicationScopedBeans" class="ApplicationScopedBean" />
<bean id="requestScopedBean" class="RequestScopedBean" scope="request">
</bean>
</beans>
when I try to run this application the bean creation of applicationScopedBean fails with the following error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ApplicationScopedBean': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private RequestScopedBean requestScopedBean; nested exception is java.lang.IllegalStateException: No Scope registered for scope 'request'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075)
at com.amazon.coral.reflect.instantiate.SpringInstantiatorFactory$1.newInstance(SpringInstantiatorFactory.java:168)
... 19 more
You have to mark your requestScopedBean as a scoped proxy also, this way Spring will inject in a proxy for requestScopedBean and in the background manage the scope appropriately.
<bean id="requestScopedBean" class="RequestScopedBean" scope="request">
<aop:scoped-proxy/>
</bean>
More here
The exception above suggests that you have not correctly configured Spring for the provision of request scoped beans.
You need to add this to your web.xml as described in the docs here:
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
However, there is more to your question than just configuration. You are attempting to inject a request scoped bean into a singleton scoped bean. Spring resolves dependencies and instantiates singletons when the DI container starts. This means that ApplicationScopedBean will only be created once (at this point there will be no request in flight and so the autowiring will most likely fail).
If you were using a prototype scoped bean instead of request scoped you'd have to consider a way of suppling the singleton scoped bean with a fresh instance everytime it was used. The approaches for this are described in the Method Injection chapter of the Spring docs.
#Airwavezx the annotation equivalent is the followinng:
#Scope( value = SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS )

Resources