Databases

Kodejava

Tag Archives: WebApplicationContext

I have created a servlet based web application and I want to used Spring beans in it. So how do I do this in my servlet. Well, it simple enough to do this. First of all I have to obtain the Spring’s WebApplicationContext, from where I can grab the required bean by my servlet.

Inside the Java Servlet doGet() method above I get the ServletContext, next the WebApplicationContextUtils help me to get Spring’s WebApplicationContext. With this object in my hand I can get my UserDao implementation and do a query from database.

Search for:

Subscribe to Kode Java via Email

Enter your email to subscribe and receive notifications of new posts by email.