SpringBoot扩展配置

一、配置随机数

RandomValuePropertySource可以用于注入随机数,它支持integer、long、uuid、string。

my.secret=${random.value}
my.number=${random.int}
my.bignumber=${random.long}
my.uuid=${random.uuid}
my.number.less.than.ten=${random.int(10)}
my.number.in.range=${random.int[1024,65536]} 不包含最大值

二、访问命令行属性

默认的,SpingApplication转换命令行参数(以--开头,如--server.port=9000),并加入到Spring 环境。如果你不想这些参数加入到Spring环境,可以使用SpringApplication.setAddCommandLineProperties(false)关闭。

 

posted @ 2020-12-02 12:31  codedot  阅读(188)  评论(0编辑  收藏  举报