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?
WEB-INF
web.xml
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.
resources
ClassPathXmlApplicationContext
src/main/resources/com/myapp/somemodule/context.xml
location: src/main/resources/
src/main/resources/
then you can be precise by adding directories such as moduleName/spring-application.xml
moduleName/spring-application.xml