Having the following configuration properties class defined:
@ConfigurationProperties("demo")
public class MyProps {
private InnerFoo innerFoo;
public class InnerFoo {
private String bar;
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
}
public InnerFoo getInnerFoo() {
return innerFoo;
}
public void setInnerFoo(InnerFoo innerFoo) {
this.innerFoo = innerFoo;
}
}
Annotation processor generates the following spring-configuration-metadata.json file:
{
"groups": [
{
"name": "demo",
"type": "com.example.demo.props.MyProps",
"sourceType": "com.example.demo.props.MyProps"
},
{
"name": "demo.inner-foo",
"type": "com.example.demo.props.MyProps$InnerFoo",
"sourceType": "com.example.demo.props.MyProps",
"sourceMethod": "getInnerFoo()"
}
],
"properties": [
{
"name": "demo.inner-foo.bar",
"type": "java.lang.String",
"sourceType": "com.example.demo.props.MyProps$InnerFoo"
}
],
"hints": [],
"ignored": {
"properties": []
}
}
Defined property demo.inner-foo.bar cannot be resolved at runtime. In some cases the demo.innerFoo field being null, and in other with the following exception:
Failed to bind properties under 'demo.inner-foo' to com.example.demo.props.MyProps$InnerFoo:
Reason: org.springframework.boot.context.properties.source.InvalidConfigurationPropertyNameException: Configuration property name 'this$0' is not valid
Having the following configuration properties class defined:
Annotation processor generates the following
spring-configuration-metadata.jsonfile:{ "groups": [ { "name": "demo", "type": "com.example.demo.props.MyProps", "sourceType": "com.example.demo.props.MyProps" }, { "name": "demo.inner-foo", "type": "com.example.demo.props.MyProps$InnerFoo", "sourceType": "com.example.demo.props.MyProps", "sourceMethod": "getInnerFoo()" } ], "properties": [ { "name": "demo.inner-foo.bar", "type": "java.lang.String", "sourceType": "com.example.demo.props.MyProps$InnerFoo" } ], "hints": [], "ignored": { "properties": [] } }Defined property
demo.inner-foo.barcannot be resolved at runtime. In some cases thedemo.innerFoofield beingnull, and in other with the following exception: