idea中src/main/resources目录下的applicationContext.xml文件访问src/main/webap目录下的配置文件

如图所示,想要在src/main/resources目录下的applicationContext.xml文件中访问src/main/webap目录下的db.properties,需要两步:

  1. applicationContext-dao.xml中进行配置(classpath:后的路径看情况可自行修改):
    <context:property-placeholder location="classpath:db.properties"/>
  2. 将webapp目录下的peoperties改成“Resources Root”

猜你喜欢

转载自blog.csdn.net/weixin_42141668/article/details/90405133