cubesoft
cubesoft

Reputation: 3550

Configuring servlet for using spring

How to configure my web application in Eclipse (based on Servlets and deployed to Tomcat) to use Spring framework. I need only IoC container (Beans only and ApplicationContext), not Spring MVC. How to configure web.xml for this?

Regards

Upvotes: 0

Views: 584

Answers (1)

Bozho
Bozho

Reputation: 597382

One way is to put this in your web.xml:

<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>

and have applicationContext.xml in WEB-INF, or have its location configured this way (in web.xml again)

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        classpath:applicationContext.xml
    </param-value>
</context-param>

Upvotes: 6

Related Questions