Skip to content

Document that the @ConfigurationProperties annotation processor cannot generate description and defaultValue metadata for external types #43925

Closed
@ZIRAKrezovic

Description

@ZIRAKrezovic

When using @ConfigurationProperties, @NestedConfigurationProperty and spring-boot-configuration-processor together with classes from another JAR, the generated JSON file will not have defaultvalue and description properties set even if default values and javadoc are present in the target class.

Consider the example: https://github.com/ZIRAKrezovic/configuration-processor-issue

The class referencing property class from Spring Boot Autoconfigure will not contain any description or defaultValue: https://github.com/ZIRAKrezovic/configuration-processor-issue/blob/main/src/main/java/com/example/demo/DemoConfigurationProperties.java

The same class copied into the code will contain description and defaultValue: https://github.com/ZIRAKrezovic/configuration-processor-issue/blob/main/src/main/java/com/example/demo/ArtemisProperties.java

Snippet of the generated metadata JSON for both prefixes

    {
      "name": "spring.artemis.embedded.enabled",
      "type": "java.lang.Boolean",
      "sourceType": "org.springframework.boot.autoconfigure.jms.artemis.ArtemisProperties$Embedded"
    },
    {
      "name": "spring.artemis-included-in-source.embedded.enabled",
      "type": "java.lang.Boolean",
      "description": "Whether to enable embedded mode if the Artemis server APIs are available.",
      "sourceType": "com.example.demo.ArtemisProperties$Embedded",
      "defaultValue": true
    }

This is an undocumented behavior and should be at least documented if it can't be outright fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions