The IoC container——SpringFrameWork学习笔记

来源:互联网 发布:黑猩猩 知乎 编辑:程序博客网 时间:2024/05/17 09:32
3.2.2.1. Composing XML-based configuration metadata
 
  1. Composing XML-based configuration metadata
  2. <beans>
  3.     <import resource="services.xml"/>
  4.     <import resource="resources/messageSource.xml"/>
  5.     <import resource="/resources/themeSource.xml"/>
  6.     <bean id="bean1" class="..."/>
  7.     <bean id="bean2" class="..."/>
  8. </beans>

 

In this example, external bean definitions are being loaded from 3 files, services.xml, messageSource.xml, and themeSource.xml. All location paths are considered relative to the definition file doing the importing, so services.xml in this case must be in the same directory or classpath location as the file doing the importing, while messageSource.xml and themeSource.xml must be in a resources location below the location of the importing file. As you can see, a leading slash is actually ignored, but given that these are considered relative paths, it is probably better form not to use the slash at all

原创粉丝点击