Spring: split the application context
source link: https://marco.dev/2009/03/06/spring-split-the-application-context/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
java-version.com: What's new in Java 16? 15? Keep up to date!
Spring: split the application context
There are many reasons to declare the beans in more than one xml file. The most important reason is to maintain the code clear with a logical separation of the content of the file. The second reason is that when the application begin big only one file is not enough for the configuration.
In Spring is easy to split the content of the applicationContext.xml:
web.xml
You have to declare the **contextConfigLocation
contextConfigLocation
/WEB-INF/yourApplicationServices.xml, /WEB-INF/yourApplicationDatabase
</context-param>
`
You can use Ant-style pattern to call your files e.g. /WEB-INF/yourApplication*.xml**
[Spring reference](https://static.springframework.org/spring/docs/2.5.x/api/org/springframework/web/context/ContextLoader.html)
Author
Marco Molteni
Marco Molteni Blog
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK