@ConfigurationProperties参数绑定标签:可以非常方便的把资源文件中的内容绑定到对象上;

     1)如果类是自己写的.

SpringBoot的@ConfigurationProperties参数绑定(四)_参数绑定SpringBoot的@ConfigurationProperties参数绑定(四)_参数绑定_02

     2)如果是第三方的组件.

SpringBoot的@ConfigurationProperties参数绑定(四)_参数绑定_03SpringBoot的@ConfigurationProperties参数绑定(四)_jar_04

3@ConfigurationProperties支持松绑定:

  @ConfigurationProperties(prefix="db")

  private String userName;

  允许匹配方式

  db.userName=xx;

  db.user_name=xx;

  db.user-name=xx;

  db_user_name=xx;

  4)命令行中,使用--开头的参数都可以被springboot视为参数,允许参数绑定;

如:java -jar springdemo-1.0.0.jar --db.username=root --db.password=abcd`````````