Sometimes it can be usefull inject the Spring context in a legacy Servlet in order to automatically inject spring beans via @Autowired annotation.
This can be easily done overriding the init method of HttpServlet and putting the statement SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this) in its implementation.

Below a simple example where myBean instance of the Spring bean is automatically injected after the execution of init method.

public class MyServlet extends HttpServlet
{
    @Autowired
    private MyBean myBean;
    ...

    public void init(ServletConfig config) throws ServletException
    {
        super.init(config);
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
        myBean.doStuff();
    }  
    ...
}

ciao