Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ZIRAKrezovic opened this issue Jan 22, 2025 · 1 comment
Labels
type: documentation A documentation update
Milestone

Comments

@ZIRAKrezovic
Copy link

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 22, 2025
@wilkinsona
Copy link
Member

In terms of functionality, this is a duplicate of #18366. Your point about the lack of documentation is a good one, though. We can use this issue to add something about the current limitations.

@wilkinsona wilkinsona changed the title spring-boot-configuration-processor not populating description and default values of classes located in another JARs Document that the @ConfigurationProperties annotation processor cannot generate description and defaultValue metadata for external types Jan 22, 2025
@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 22, 2025
@wilkinsona wilkinsona added this to the 3.3.x milestone Jan 22, 2025
@wilkinsona wilkinsona modified the milestones: 3.3.x, 3.3.8 Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

3 participants