只需要在applicationContext.xml文件中添加一行:
<!-- 导入外部的properties文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>  
其中:location属性是指该文件的位置。
如果是在src目录下的话,该位置为:classpath:文件名.后缀
如果是在/WEB-INF/目录下的话,该位置为: /WEB-INF/文件名.后缀

但是要注意,不要放错位置了,<context:property-placeholder>不能发到<bean></bean>标签里面去。
或者会报错;





相关文章:

  • 2022-12-23
  • 2021-11-19
  • 2021-08-10
  • 2021-11-23
  • 2021-07-12
  • 2022-12-23
  • 2021-07-15
  • 2021-12-08
猜你喜欢
  • 2019-10-11
  • 2022-12-23
  • 2021-08-28
  • 2022-01-27
  • 2021-08-03
相关资源
相似解决方案