@NestedConfigurationProperty: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Spring Boot Property Injection * @ConfigurationProperties")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
* [[Spring_Boot_Property_Injection#.40NestedConfigurationProperty|Spring Boot Property Injection]]
* [[Spring_Boot_Property_Injection#.40NestedConfigurationProperty|Spring Boot Property Injection]]
* [[@ConfigurationProperties]]
* [[@ConfigurationProperties]]
=Example=
<syntaxhighlight lang='java'>
@Component
@ConfigurationProperties(prefix = "example.cryptm")
public class CryptmPropertyConfiguration {
    private String masterKeyArn;
    ...
    @NestedConfigurationProperty
    private DataKeyCachingConfiguration dataKeyCaching;
    ...
}
</syntaxhighlight>
The class that holds the nested configuration does not need to be annotated, it only needs to be coded as a Java Bean.

Latest revision as of 23:42, 2 January 2019

Internal

Example

@Component
@ConfigurationProperties(prefix = "example.cryptm")
public class CryptmPropertyConfiguration {

    private String masterKeyArn;

    ...

    @NestedConfigurationProperty
    private DataKeyCachingConfiguration dataKeyCaching;

    ...
}

The class that holds the nested configuration does not need to be annotated, it only needs to be coded as a Java Bean.