Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning with @ConfigurationProperties Annotation

I Can see the following warning with @ConfigurationProperties Annotation

When using @ConfigurationProperties it is recommended to add 'spring-boot-configuration-processor' to your classpath to generate configuration metadata

Everything working fine. What it meant for?

like image 418
Narendar Reddy M Avatar asked Apr 17 '19 06:04

Narendar Reddy M


People also ask

What is @ConfigurationProperties annotation in spring boot?

@ConfigurationProperties allows to map the entire Properties and Yaml files into an object easily. It also allows to validate properties with JSR-303 bean validation. By default, the annotation reads from the application. properties file. The source file can be changed with @PropertySource annotation.

What is @ConstructorBinding?

Annotation Type ConstructorBindingAnnotation that can be used to indicate that configuration properties should be bound using constructor arguments rather than by calling setters. Can be added at the type level (if there is an unambiguous constructor) or on the actual constructor to use.

What is the best way to give spring configuration metadata?

You can easily generate your own configuration metadata file from items annotated with @ConfigurationProperties by using the spring-boot-configuration-processor jar. The jar includes a Java annotation processor which is invoked as your project is compiled.


1 Answers

If you add an optional dependency to the “spring-boot-configuration-processor”, your module will hold a meta-data file that is generated at compile time with details about your properties. IDEs can then pick that up to show you content assist/auto-completion. STS, Intellij IDEA and Netbeans have such support . It is an annotation processor that generates metadata about classes in your application that are annotated with @ConfigurationProperties.

More info here: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#configuration-metadata

https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/htmlsingle/#configuration-metadata-annotation-processor

like image 133
Mebin Joe Avatar answered Sep 21 '22 23:09

Mebin Joe