There are two main aspects of binding Spring to servlets. First you need to load the Spring application context, and secondly, you need to expose these Spring-loaded objects in the Servlet. There are many ways to do this, and in formats like CXF , there is native support for Spring.
ContextLoaderListener HttpRequestHandlerServlet .
:
web.xml:
<web-app>
...
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>servletBean</servlet-name>
<servlet-class>org.springframework.web.context.support.HttpRequestHandlerServlet</servlet-class>
</servlet>
...
</web-app>
/WEB -INF/applicationContext.xml:
<beans>
..
<bean id="servletBean" name="servletBean" class="yournamespace.YourServletClass">
...
</bean>
...
</beans>