Spring 3.0--Composing XML-based configuration metadata

<beans>
<import resource="services.xml"/>
<import resource="resources/messageSource.xml"/>
<import resource="/resources/themeSource.xml"/>
<bean id="bean1" class="..."/>
<bean id="bean2" class="..."/>
</beans> 





  It is possible, but not recommended, to reference files in parent directories using a relative
"../" path. Doing so creates a dependency on a file that is outside the current application. Inparticular, this reference is not recommended for "classpath:" URLs (for example,"classpath:../services.xml"), where the runtime resolution process chooses the "nearest"classpath root and then looks into its parent directory. Classpath configuration changes maylead to the choice of a different, incorrect directory.
  You can always use fully qualified resource locations instead of relative paths: for example,"file:C:/config/services.xml" or "classpath:/config/services.xml". However, be aware that you are coupling your application's configuration to specific absolute locations. It is generally preferable to keep an indirection for such absolute locations, for example, through "${...}" placeholders that are resolved against JVM system properties at runtime.

 

你可能感兴趣的:(spring,jvm,c,xml,bean)