如果我将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 做这样的事情?还是我需要自己写一些东西?