springboot中yml属性的注入.md
更新日期:
springboot中yml文件
yml语法
1 | k:(空格)v :表示一对键值对(空格必须有); |
测试
实体配置
此处省略了get,set,toString方法
1 | @ConfigurationProperties(prefix = "com.yml.test") |
测试yml配置
1 | com: |
开启配置
1 | @Configuration |
读取配置信息并打印
1 | Person{name='hello', age=20, boss=true, birth=Thu May 20 00:00:00 CST 1999, maps={hello=hello, world=world}, lists=[11111, 22222], dog=Dog{name='tom', age=2}} |