views:

78

answers:

1

I know that in a standalone application I create one of the application context instances which in turn creates the beans from conf files. But I can not see any such code in dispatched servlet. How then are the beans created in a web application?

+5  A: 

The ContextLoaderListener creates an ApplicationContext (by delegating to ContextLoader) and stores it in the servlet context.

So you have to map the ContextLoaderListener is a <listener> in web.xml

Then, of course, that ApplicationContext (WebApplicationContext in this case) creates the beans.

Bozho