{"id":62,"date":"2021-11-12T18:09:09","date_gmt":"2021-11-12T18:09:09","guid":{"rendered":"https:\/\/blog.kevinyohe.dev\/?p=62"},"modified":"2021-11-12T18:09:46","modified_gmt":"2021-11-12T18:09:46","slug":"spring-enableconfigurationproperties-annotation","status":"publish","type":"post","link":"https:\/\/blog.kevinyohe.dev\/?p=62","title":{"rendered":"Spring &#8211; @EnableConfigurationProperties Annotation"},"content":{"rendered":"\n<p><em>@EnableConfigurationProperties<\/em>&nbsp;Annotation is connected to @ConfigurationProperties<\/p>\n\n\n\n<p>Every project automagically includes @EnableConfigurationProperties, and @ConfigurationProperties support is implicitly turned on in every application<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to Use it<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code alignwide\"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\n@ConfigurationProperties(prefix = &quot;additional&quot;)\npublic class AdditionalProperties {\n\n    private String unit;\n    private int max;\n\n    \/\/ standard getters and setters\n}\n<\/pre><\/div>\n\n\n<p>This is our configuration class to configure other parts of the application. Now we can &#8220;register&#8221; our configuration bean using @EnableConfigurationProperties<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code alignwide\"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\n@Configuration\n@EnableConfigurationProperties(AdditionalProperties.class)\npublic class AdditionalConfiguration {\n    \n    @Autowired\n    private AdditionalProperties additionalProperties;\n    \n    \/\/ make use of the bound properties\n}\n<\/pre><\/div>\n\n\n<p>Now we can use AdditionalProperties like any other Spring bean.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>@EnableConfigurationProperties&nbsp;Annotation is connected to @ConfigurationProperties Every project automagically includes @EnableConfigurationProperties, and @ConfigurationProperties support is implicitly turned on in every application How to Use it This is our configuration class to configure other parts of the application. Now we can &#8220;register&#8221; our configuration bean using @EnableConfigurationProperties Now we can use AdditionalProperties like any other Spring bean.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":2,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"predecessor-version":[{"id":64,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions\/64"}],"wp:attachment":[{"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kevinyohe.dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}