如图所示,想要在src/main/resources目录下的applicationContext.xml文件中访问src/main/webap目录下的db.properties,需要两步:
- applicationContext-dao.xml中进行配置(classpath:后的路径看情况可自行修改):
<context:property-placeholder location="classpath:db.properties"/>
- 将webapp目录下的peoperties改成“Resources Root”