@Value注解
@Value("${mytest.value}")
String value;
在applcation.properties增加配置项
mytest.test: 55555
或者application.yml添加
mytest:
test: 55555
也可以初始化对象或者数组
对象
mytest:
test: 55555
test1: 34242
或者数组
mytest:
-test: 55555
-test1: 34242