Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 808
Eric Wilson Avatar asked Apr 18 '13 18:04

Eric Wilson


2 Answers

location : src/main/resources/

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

like image 182
jmj Avatar answered Sep 20 '22 21:09

jmj


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.

like image 39
kan Avatar answered Sep 22 '22 21:09

kan