Spring-Resource

来源:互联网 发布:mac彩妆专柜几月打折 编辑:程序博客网 时间:2024/06/04 14:03

FileSystemXmlApplicationContext

适合测试环境配置。
Standalone XML application context, taking the context definition files from the file system or from URLs, interpreting plain paths as relative file system locations (e.g. “mydir/myfile.txt”). Useful for test harnesses as well as for standalone environments.

无前缀的路径会被解释为相对于当前虚拟机的工作路径,即使你加上斜杠也是这样解释。
如果你明确加上前缀file,则强制以绝对路径来读取
NOTE: Plain paths will always be interpreted as relative to the current VM working directory, even if they start with a slash. (This is consistent with the semantics in a Servlet container.) Use an explicit “file:” prefix to enforce an absolute file path.

classpath:xxx.XML
/WEB-INF/applicationContext.XML
file:absolute_path.xml

原创粉丝点击