Tuesday, October 5, 2010

Introduction and Context Servlet container



Servlet container start to create a number of objects, such as Servlet, filter, listener, spring, etc. So how do these objects?

Here in the Servlet (or Filter, or Listener) in the spring of the IOC to use the container create the default Servlet container spring container object, injected into the Servlet Context in, Servlet Context object is injected into the session object, session object is injected into the request object, request object is injected into the Servlet object, (the injection is not very standard, is mass parameters, or directly pay the value of the property). Layers can be dependent on spring container object.

WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext (request.getSession (). GetServletContext ());

So you can directly remove the Web Application Context Servlet Context object:

WebApplicationContext webApplicationContext = (WebApplicationContext) servletContext.getAttribute (WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

In fact Web Application ContextUtils.getWebApplicationContext is to use the above code to achieve, recommended above, the static method above

Note: use the web Application Context.getBean ("ServiceName") when, in front of forced conversion to use interface, if the implementation class will be reported using the type conversion error. Such as:

LUserService userService = (LUserService) webApplicationContext.getBean ("userService");







Recommended links:



Backup AND Restore Expert



Fireworks in the production of glass jar



Switch to the best period of 2 to 3 years



BOE Holdings East TPV regulators have not yet Ratified Difficult



AVI to MPEG4



Shenzhen Julong year launched China's first six-generation LCD line



XviD to MP4



Brief Firewall And Proxy Servers



P2P operators transform their billing through traffic into the regular army



China's attitude towards certain of HL7



Cult3D Animation with 3DMax DEFAULT works



Top Mail Servers



MPEG to 3GP



Mito Xiu 1 minute to create non-mainstream days



How Do Wireless Networks Work



No comments:

Post a Comment