View Full Version : Accessing spring context from a servlet
Oct 2nd, 2008, 04:43 PM
I basically have a simple webapp, hello world servlet, in which I want to inject a service, without using spring-mvc. Is that possible?
Oct 3rd, 2008, 02:09 AM
This is not really a Spring DM question but rather a general container question. There are bridges between Servlets and the Spring container: http://static.springframework.org/spring/docs/2.5.x/reference/web-integration.html
Since servlets are managed by the web container, applying injection on them is tricky since the instance becomes managed by more then one entity (Spring + container).
That's why in general, Servlets are used for routing requests (as a dispatcher) while the web framework takes care of creating and configuring the actual request endpoints.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.