Hi all,
This may be a relatively straight-forward question that I just haven't been searching for correctly, but I'm trying to use the Spring IoC container to configure my servlets. I have some additional handlers (that are private data members) and such that I would like to be configured at runtime. Is it possible to do this?
Right now I have my web.xml loading the servlets correctly, however, the problem is I'm not sure how to wire those instances to the Spring IoC container, or alternatively, wire the instances generated from the IoC container to the servlet container.
In my web.xml file, I'm setting up the ContextLoaderListener
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
And also configuring the correct location for the beans context
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/beans.xml
</param-value>
</context-param>
I also know that the beans.xml
file is being parsed because I got several exceptions when I had typed things incorrectly.
Thoughts? Is there a better way to do this?