Faire des include de fichiers de configuration est une mauvaise idée, il vaut mieux utiliser ce genre de choses :
Code:
1 2
| ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
new String[] {"applicationContext.xml", "applicationContext-part2.xml"}); |
Dans le cas d'une appli web, chaque Dispatcher contient sa configuration dans un fichier [nomservlet]-servlet.xml. La configuration des autres couches est chargée en utilisant ce genre de configuration dans le web.xml :
Code:
1 2 3 4 5 6 7 8
| <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param> |