public abstract class SpringBeanAutowiringSupport
extends java.lang.Object
@Autowired
annotations in the endpoint class against beans in the current Spring
root web application context (as determined by the current thread's
context ClassLoader, which needs to be the web application's ClassLoader).
Can alternatively be used as a delegate instead of as a base class.
A typical usage of this base class is a JAX-WS endpoint class:
Such a Spring-based JAX-WS endpoint implementation will follow the
standard JAX-WS contract for endpoint classes but will be 'thin'
in that it delegates the actual work to one or more Spring-managed
service beans - typically obtained using @Autowired
.
The lifecycle of such an endpoint instance will be managed by the
JAX-WS runtime, hence the need for this base class to provide
@Autowired
processing based on the current Spring context.
NOTE: If there is an explicit way to access the ServletContext,
prefer such a way over using this class. The WebApplicationContextUtils
class allows for easy access to the Spring root web application context
based on the ServletContext.
WebApplicationObjectSupport
Constructor and Description |
---|
SpringBeanAutowiringSupport()
This constructor performs injection on this instance,
based on the current web application context.
|
Modifier and Type | Method and Description |
---|---|
static void |
processInjectionBasedOnCurrentContext(java.lang.Object target)
Process
@Autowired injection for the given target object,
based on the current web application context. |
static void |
processInjectionBasedOnServletContext(java.lang.Object target,
ServletContext servletContext)
Process
@Autowired injection for the given target object,
based on the current root web application context as stored in the ServletContext. |
public SpringBeanAutowiringSupport()
Intended for use as a base class.
public static void processInjectionBasedOnCurrentContext(java.lang.Object target)
@Autowired
injection for the given target object,
based on the current web application context.
Intended for use as a delegate.
target
- the target object to processContextLoader.getCurrentWebApplicationContext()
public static void processInjectionBasedOnServletContext(java.lang.Object target, ServletContext servletContext)
@Autowired
injection for the given target object,
based on the current root web application context as stored in the ServletContext.
Intended for use as a delegate.
target
- the target object to processservletContext
- the ServletContext to find the Spring web application context inWebApplicationContextUtils.getWebApplicationContext(javax.servlet.ServletContext)