Access a Spring Bean from within a Servlet

Tuesday, September 21st, 2010

ApplicationContext context =
    WebApplicationContextUtils.getWebApplicationContext(getServletContext());
MyService service = (MyService) context.getBean("serviceBeanName");

You can leave a response, or trackback from your own site.

Tags: ,
Posted in: Development, quick tips



Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>