spring-projects / spring-projects/spring-boot

Do not generate metadata for non-static nested class that are not initialized

Open
#50,133 5 comments 0 reactions 1 assignee View on GitHub

@Jidnyashah is already working on this.

Since Apr 23, 2026.

type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.