Where to put Spring context file for a Maven/Java project with no WEB-INF directory?

configuration, java, maven, spring

Solution

Put it in a `resources` folder. And use `ClassPathXmlApplicationContext` to load them. Use packages as your java classes use. E.g. `src/main/resources/com/myapp/somemodule/context.xml`.

Problem

I want to use spring for a non-web Java project. Where should the context file go? How do I identify their locations to the Spring container? I'm sure there are various choices, but with a web application it is typical to put things in `WEB-INF`, and to declare the locations in the `web.xml`. How is this done in a stand-alone app?

Original source