一、配置随机数
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)关闭。
时刻与技术进步,每天一点滴,日久一大步!!! 本博客只为记录,用于学习,如有冒犯,请私信于我。
Original: https://www.cnblogs.com/myitnews/p/14073092.html
Author: codedot
Title: SpringBoot扩展配置
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/541146/
转载文章受原作者版权保护。转载请注明原作者出处!