Tuesday, 8 June 2010

Accessing Spring Beans in Servlet

Sometimes you just have to do the do in a servlet. Here is a nice cheeky little way of getting to the applciation context:

WebApplicationContextUtils.getRequiredWebApplicationContext(request.getSession().getServletContext())

Then from there you can use getBean() etc...

Ref: http://forum.springsource.org/showthread.php?t=18833

No comments:

Post a Comment