springboot中获取配置文件的值

1.在application.properties中

ds-portal_service_port=http://192.168.**.**:10001

2.在java中

@Autowired
private Environment environment;

String portalPort = environment.getProperty("ds-portal_service_port");//获取


posted @ 2021-09-18 10:47  不是安逸  阅读(415)  评论(1编辑  收藏  举报