spring boot项目获取application配置文件参数的两种方式

前言:了解过spring boot这个技术的,应该知道spring boot的核心配置文件application.properties,当然也可以通过注解自定义配置文件**.properties的信息。

(1)核心配置文件application.properties内容如下:

  1. test.msg=Hello World SpringBoot  

方式一:使用@Value方式(常用)

方式二:使用Environment方式

猜你喜欢

转载自blog.csdn.net/weixin_42178492/article/details/81539003