Rule-ID: springboot.context-no-value-annotation
Spring provides the annotation org.springframework.beans.factory.annotation.Value
to inject properties from external
property sources into the application context. While this is handsome in plain Spring applications, Spring Boot offers something
better: org.springframework.boot.context.properties.ConfigurationProperties
. This has the following advantage:
- No magic strings anymore inside
@Value
- Typed and reusable properties
- Code completion in
application.yaml
andapplication.properties
files when using theorg.springframework.boot:spring-boot-configuration-processor
See the official Spring documentation for more details