springBoot---@ConfiggurationProperties注解

1.首先导入jar包,配置文件的随机值有以下几种写法

${random.value}、${random.int}、${random.long}、${random.uuid} 、${random.int(10)}、${random.int(1024,65536)} .etc

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-configuration-processor</artifactId>
  <optional>true</optional>
</dependency>

 

 

 

 2.在我们的application.yml文件中写入我们需要配置的内容,然后在实体类中进行引用

 

 

 

 3.编写我们接口层的代码,获取到实体类中的数据

 

 4.启动之后我们查看此接口的信息

 

 

 

posted @ 2021-01-14 09:45  沫笙*  阅读(210)  评论(0编辑  收藏  举报