spring boot应用程序获取配置文件的配置信息的方法:
1.通过@Value注释获取
2.通过Environment类获取
3.通过@ConfigurationProperties获取
application.properties文件内容:
1 server.port=8080 2 3 4 spring.main.banner-mode=off 5 6 myconfig.mail.port=1234
spring boot应用程序获取配置文件的配置信息的方法:
1.通过@Value注释获取
2.通过Environment类获取
3.通过@ConfigurationProperties获取
application.properties文件内容:
1 server.port=8080 2 3 4 spring.main.banner-mode=off 5 6 myconfig.mail.port=1234
相关文章: