Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring configuration properties metadata json for nested list of Objects

Tags:

How does one configure spring configuration metadata json for nested list of objects?

Scenario

@ConfigurationProperties(prefix = "custom-config")
public class ConfigProperties {

    private boolean booleanProperty;
    private List<NestedObject> listProperty = new LinkedList<>();

    //getters and setters
}

public class NestedObject {

    private String stringProperty;
    private boolean booleanProperty;

    //getters and setters

}

This is what was auto generated in the metadata json

{
  "groups": [{
    "name": "custom-config",
    "type": "testing.config.properties.ConfigProperties",
    "sourceType": "testing.config.properties.ConfigProperties"
  }],
  "properties": [
    {
      "name": "custom-config.boolean-property",
      "type": "java.lang.Boolean",
      "sourceType": "testing.config.properties.ConfigProperties",
      "defaultValue": false
    },
    {
      "name": "custom-config.list-property",
      "type": "java.util.List<testing.config.properties.NestedObject>",
      "sourceType": "testing.config.properties.ConfigProperties"
    }
  ],
  "hints": []
}

How do I configure the child properties either in java code or in json?

As seen below, the editor doesn't recognise the child properties.

enter image description here