Spring Boot 3-外部配置

Posted zengpingtang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring Boot 3-外部配置相关的知识,希望对你有一定的参考价值。

Springboot允许使用properties、yml、命令行参数作为外部配置。

1、命令行配置。
java -jar xxx.jar --server.prot=9090
2、常规属性配置。
在application.yml里添加
melo:
  name: tony
@Value("${melo.name}")
private String name;

以上是关于Spring Boot 3-外部配置的主要内容,如果未能解决你的问题,请参考以下文章