最佳答案
正如Rod Johnson在this thread中解释的那样:
You can use the
classpath:
prefix to load from the classpath,with the normal Spring listener or startup servlet. This is made possible by Spring’s Resource abstraction. You can freely mix and match resources fromWEB-INF
and classpath.
因此,将配置文件放在webapp外部的类路径中的某个位置,并在web.xml中声明以下内容:
aram>
aram-name>contextConfigLocation
aram-name>
aram-value>classpath:springContext*.xml
aram-value>
aram>
我认为依赖类路径比使用绝对文件路径更便携.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。