根据不同环境获取不同参数,放在配置⽂件便于更改!
回调appId(测试⽤)
通过以下⽅式实现:
1,通过@ConfigurationProperties(prefix = \"weixinAndAPP\")注解,代码如下
import org.springframework.boot.context.properties.ConfigurationProperties;import org.springframework.stereotype.Component;/**
* @ClassName: TestRY
* @Description:TODO(配置类) * @author: sunfee
* @date: 2019年12⽉09⽇ */
@Component
@ConfigurationProperties(prefix = \"weixinAndAPP\")public class TestRY { private String appId; private String hotline; public String getAppId() { return appId; }
public void setAppId(String appId) { this.appId = appId; }
public String getHotline() { return hotline; }
public void setHotline(String hotline) { this.hotline = hotline; }}
在⽅法中调⽤,只需要注⼊资源就可: @Autowired
private TestRY testRY;
testRY.getAppId(); testRY.getHotline();
⽅法直接调⽤赋值即可。
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- huatuowenda.com 版权所有 湘ICP备2023022495号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务