I want to expand configuration metadata in my project just as mentioned in the documentation.
Usually, I can use the spring-boot-configuration-processor
dependency to generate my own metadata. But in this case, I'm using Map<String, Foo>
properties in my properties, and I want the IDE to show code hints when using these propertie.
Let me show you the code.
FooProperties
@ConfigurationProperteis("server.worker")
public class FooProperties {
private int workerCount;
private int subWorkerCount;
private int limit;
@NestedConfigurationProperty
private Map<String, BooProperties> group = new HashMap<>();
//getter and setter
}
BooProperties
public class BooProperties{
private int workerCount;
}
additional-spring-configuration-metadata.json
{
"properties":[{
"name": "server.worker.group",
"type":"java.util.Map<java.lang.String,com.FooProperties>",
"description": ".....",
"sourceType":"com.FooProperties"
}],
"hints":[{
"name":"server.worker.group.keys",
"providers":[{
"name":"any"
}]
}, {
"name":"server.worker.group.values",
"providers" : [{
"name":"class-reference"
}]
}]
}
And this is an image of my IDE, not showing any hints:
Is there anything I can change to make this work?