【发布时间】:2020-02-12 14:03:06
【问题描述】:
如果我包含 spring-boot-configuration-processor 作为依赖项,我的构建将生成一个这样的 json 文件:
{
"groups": [
{
"name": "attachments",
"type": "com.example.config.AttachmentsSettings",
"sourceType": "com.example.config.AttachmentsSettings"
}
],
"properties": [
{
"name": "attachments.max-size",
"type": "java.lang.Integer",
"sourceType": "com.example.config.AttachmentsSettings",
"defaultValue": 1024
},
{
"name": "attachments.min-size",
"type": "java.lang.Integer",
"sourceType": "com.example.config.AttachmentsSettings"
},
{
"name": "attachments.invalid-chars",
"type": "java.lang.String",
"sourceType": "com.example.config.AttachmentsSettings",
"defaultValue": "abc"
}
],
"hints": []
}
我想另外生成一个属性文件,列出所有属性及其默认值,如下所示:
attachments.max-size=1024
attachments.invalid-chars=abc
# attachments.min-size=
理想情况下,我还希望它列出没有默认值但被注释掉的属性。
是否可以使用 Spring Boot 做这样的事情?还是我需要自己写点东西?
【问题讨论】:
标签: spring-boot spring-annotations annotation-processing spring-boot-configuration