项目加载中读取配置文件:
还需要配置
在ContextLoaderListener加载时,会查找名为contextConfigLocation的参数。因此,配置
@Value('${weixin.appId}') private String appId; @Value('${weixin.order}') private String orderUrl; @Value('${weixin.mergeOrderUrl}')直接使用$获取。但是要和配置文件对应。
generalPay.remote.port=${general.pay.remote.port}weixin.secret=${filter.weixin.secret}weixin.appId=${filter.weixin.appId}
最后在pom.xml配置参数信息,即可。