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

I want to use spring for a non-web Java project. Where should the context file go? How to determine their location in a spring container?

I'm sure there are different options, but with a web application it’s typical to put things in WEB-INFand declare locations in web.xml. How is this done in a standalone application?

+5
source share
2 answers

Put it in a folder resources. And use ClassPathXmlApplicationContextto download them. Use packages according to your Java classes. For instance. src/main/resources/com/myapp/somemodule/context.xml.

+4
source

location: src/main/resources/

then you can be precise by adding directories such as moduleName/spring-application.xml

+6
source

All Articles