org.springframework.boot.context.properties

Annotation Type ConstructorBinding



  • @Target(value={TYPE,CONSTRUCTOR})
     @Retention(value=RUNTIME)
     @Documented
    public @interface ConstructorBinding
    Annotation 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.

    Note: To use constructor binding the class must be enabled using @EnableConfigurationProperties or configuration property scanning. Constructor binding cannot be used with beans that are created by the regular Spring mechanisms (e.g. @Component beans, beans created via @Bean methods or beans loaded using @Import).

    Since:
    2.2.0
    See Also:
    ConfigurationProperties