applicationContext.xml 和spring-mvc.xml 各自加载了一遍,context:property-placeholder配置在spring中,mvc慢加载一步,把值给覆盖了
结论:把应该配置在applicationContext中的properties文件,配置在applicationContext.xml 里面
把应该配置在spring-mvc中的properties文件,配置在spring-mvc.xml里面
如:
或着
这个问题我刚刚碰到解决了,我项目一直是好一阵坏一阵,从svn上拉下来有时候能加载上有时候加载不上
[quote]<context:property-placeholder file-encoding="UTF-8" location="classpath:*.properties"/>[/quote]
用这个把,关键不要写名字写*.properties,我发现spring中很多写名字的都无法加载。
参考:http://www.oschina.net/question/2309077_2139153
http://bbs.youkuaiyun.com/topics/390601001
http://www.xnbing.org/?p=772
结论:把应该配置在applicationContext中的properties文件,配置在applicationContext.xml 里面
把应该配置在spring-mvc中的properties文件,配置在spring-mvc.xml里面
如:
<context:property-placeholder ignore-unresolvable="true" location="classpath:*.properties"/>或着
<context:property-placeholder ignore-unresolvable="true" location="classpath:remote.properties"/>
<context:property-placeholder ignore-unresolvable="true" location="classpath:application.properties"/>这个问题我刚刚碰到解决了,我项目一直是好一阵坏一阵,从svn上拉下来有时候能加载上有时候加载不上
[quote]<context:property-placeholder file-encoding="UTF-8" location="classpath:*.properties"/>[/quote]
用这个把,关键不要写名字写*.properties,我发现spring中很多写名字的都无法加载。
参考:http://www.oschina.net/question/2309077_2139153
http://bbs.youkuaiyun.com/topics/390601001
http://www.xnbing.org/?p=772
本文解决了一个关于Spring框架中属性占位符加载顺序的问题,即applicationContext.xml和spring-mvc.xml中context:property-placeholder配置导致的冲突,并提供了解决方案。
822

被折叠的 条评论
为什么被折叠?



