Skip to content

Support scanning @Value annotation for metadata in reguler @Component when using spring-boot-configuration-processor #42429

@frode-carlsen

Description

@frode-carlsen

Quite often separate classes with configuration details aren't used in Spring Boot code. Instead @Value parameters are injected directly into for example @Component or @Service objects. If applying @ConfigurationProperties to such classes a warning is issued against this.

It would be very helpful to generate metadata for classes that have injected properties, but are not @ConfigurationProperites classes, as in the following case

@Component
public class SomeComponent {
  public SomeComponet(AnotherBean anotherBean, @Value("some.config.property:true") someProperty){
  }
}

I'm suggesting the processor should pick up the "some.config.property" with default value true and generate the appropriate metadata json file for this. It would greatly simplify processing and validation of configuration properties without enforcing a particular separation of properties and components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions