{"id":30592,"date":"2014-09-24T19:00:38","date_gmt":"2014-09-24T16:00:38","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=30592"},"modified":"2014-09-24T07:10:54","modified_gmt":"2014-09-24T04:10:54","slug":"using-configurationproperties-in-spring-boot","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html","title":{"rendered":"Using @ConfigurationProperties in Spring Boot"},"content":{"rendered":"<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/logo-spring-io1.png\"><img decoding=\"async\" class=\"alignright size-medium wp-image-30677\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/logo-spring-io1-300x94.png\" alt=\"logo-spring-io\" width=\"300\" height=\"94\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/logo-spring-io1-300x94.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/logo-spring-io1.png 352w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In my latest blog post I described shortly how one can <a href=\"http:\/\/www.javacodegeeks.com\/2014\/09\/testing-mail-code-in-spring-boot-application.html\">configure mail in Spring Boot application<\/a>. To inject properties into the configuration I used Spring\u2019s <code>@Value<\/code> annotation. But <em>Spring Boot provides an alternative method of working with properties that allows strongly typed beans to govern and validate the configuration of your application.<\/em> In this post I will demonstrate how to utilize <code>@ConfigurationProperties<\/code> while configuring the application.<\/p>\n<p>So we want to use the mail configuration as an example. The configuration file is placed in a separate file, called <code>mail.properties<\/code>. The properties must be named using a proper convention, so they can be bind properly. Let\u2019s see some examples:<\/p>\n<ul>\n<li><code>protocol<\/code> and <code>PROTOCOL<\/code> will be bind to <code>protocol<\/code> field of a bean<\/li>\n<li><code>smtp-auth<\/code>, <code>smtp_auth<\/code>, <code>smtpAuth<\/code> will be bind to <code>smtpAuth<\/code> field of a bean<\/li>\n<li><code>smtp.auth<\/code> will be bind to \u2026 hmm to <code>smtp.auth<\/code> field of a bean!<\/li>\n<\/ul>\n<p>Spring Boot uses some relaxed rules for binding properties to <code>@ConfigurationProperties<\/code> beans and supports hierarchical structure.<\/p>\n<p>So let\u2019s create a <code>@ConfigurationProperties<\/code> bean:<\/p>\n<pre class=\" brush:java;wrap-lines:false\">@ConfigurationProperties(locations = \"classpath:mail.properties\", ignoreUnknownFields = false, prefix = \"mail\")\r\npublic class MailProperties {\r\n\r\n    public static class Smtp {\r\n\r\n        private boolean auth;\r\n        private boolean starttlsEnable;\r\n\r\n        \/\/ ... getters and setters\r\n    }\r\n\r\n    @NotBlank\r\n    private String host;\r\n    private int port;  \r\n    private String from;\r\n    private String username;\r\n    private String password;\r\n    @NotNull\r\n    private Smtp smtp;\r\n\r\n    \/\/ ... getters and setters\r\n\r\n}<\/pre>\n<p>\u2026 that should be created from the following properties (<code>mail.properties<\/code>):<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\" brush:java\">mail.host=localhost\r\nmail.port=25\r\nmail.smtp.auth=false\r\nmail.smtp.starttls-enable=false\r\nmail.from=me@localhost\r\nmail.username=\r\nmail.password=<\/pre>\n<p>In the above example, we annotated a bean with <code>@ConfigurationProperties<\/code>so that Spring Boot can bind properties to it. <code>ignoreUnknownFields = false<\/code> tells Spring Boot to throw an exception when there are properties that do not match a declared field in the bean. This is pretty handy during the development! <code>prefix<\/code> let you select the name prefix of the properties to bind.<\/p>\n<p>Please note that setters and getters should be created in <code>@ConfigurationProperties<\/code> bean! And opposite to <code>@Value<\/code> annotation it may bring some extra noise to the code (especially in simple cases, in my opinion).<\/p>\n<p>Ok, but we want to use the properties to configure our application. There are at least two ways of creating <code>@ConfigurationProperties<\/code>. We can either use it together with <code>@Configuration<\/code> that provides <code>@Bean<\/code>s or we can use it separately and inject into <code>@Configuration<\/code> bean.<\/p>\n<p>The first scenario:<\/p>\n<pre class=\" brush:java\">@Configuration\r\n@ConfigurationProperties(locations = \"classpath:mail.properties\", prefix = \"mail\")\r\npublic class MailConfiguration {\r\n\r\n    public static class Smtp {\r\n\r\n        private boolean auth;\r\n        private boolean starttlsEnable;\r\n\r\n        \/\/ ... getters and setters\r\n    }\r\n\r\n    @NotBlank\r\n    private String host;\r\n    private int port;  \r\n    private String from;\r\n    private String username;\r\n    private String password;\r\n    @NotNull\r\n    private Smtp smtp;\r\n\r\n    \/\/ ... getters and setters   \r\n\r\n    @Bean\r\n    public JavaMailSender javaMailSender() {\r\n        \/\/ omitted for readability\r\n    }\r\n}<\/pre>\n<p>In the second scenario, we simply annotate the properties bean (as above) and use Spring\u2019s<code>@Autowire<\/code>to inject it into mail configuration bean:<\/p>\n<pre class=\" brush:java\">@Configuration\r\n@EnableConfigurationProperties(MailProperties.class) \r\npublic class MailConfiguration {\r\n\r\n    @Autowired\r\n    private MailProperties mailProperties;\r\n\r\n    @Bean\r\n    public JavaMailSender javaMailSender() {\r\n        \/\/ omitted for readability\r\n    }\r\n}<\/pre>\n<p>Please note <code>@EnableConfigurationProperties<\/code>annotation. This annotation tells Spring Boot to enable support for <code>@ConfigurationProperties<\/code> of a specified type. If not specified, you may otherwise see the following exception:<\/p>\n<pre class=\" brush:java;wrap-lines:false\">org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [demo.mail.MailProperties] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}<\/pre>\n<p>Just a note: there is other way (there is always other way with Spring Boot!) to make that <code>@ConfigurationProperties<\/code> annotated beans will be added &#8211; just add <code>@Configuration<\/code> or <code>@Component<\/code> annotation to the bean, so it can be discovered during component scan.<\/p>\n<p>To sum up, <code>@ConfigurationProperties<\/code> beans are pretty handy. Is it better than using <code>@Value<\/code> annotation? In certain scenarios probably yes, but this is just the choice you need to make.<\/p>\n<ul>\n<li>Have a look at Spring Boot\u2019s documentation to read more about typesafe configuration properties: <a href=\"http:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/htmlsingle\/#boot-features-external-config-typesafe-configuration-properties\" target=\"_blank\">http:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/htmlsingle\/#boot-features-external-config-typesafe-configuration-properties<\/a><\/li>\n<\/ul>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/blog.codeleak.pl\/2014\/09\/using-configurationproperties-in-spring.html\">Using @ConfigurationProperties in Spring Boot<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> Rafal Borowiec at the <a href=\"http:\/\/blog.codeleak.pl\/\">Codeleak.pl<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In my latest blog post I described shortly how one can configure mail in Spring Boot application. To inject properties into the configuration I used Spring\u2019s @Value annotation. But Spring Boot provides an alternative method of working with properties that allows strongly typed beans to govern and validate the configuration of your application. In this &hellip;<\/p>\n","protected":false},"author":516,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-30592","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using @ConfigurationProperties in Spring Boot<\/title>\n<meta name=\"description\" content=\"In my latest blog post I described shortly how one can configure mail in Spring Boot application. To inject properties into the configuration I used\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using @ConfigurationProperties in Spring Boot\" \/>\n<meta property=\"og:description\" content=\"In my latest blog post I described shortly how one can configure mail in Spring Boot application. To inject properties into the configuration I used\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-24T16:00:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rafal Borowiec\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/kolorobot\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rafal Borowiec\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html\"},\"author\":{\"name\":\"Rafal Borowiec\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b1a0b2657d5dd2459806446ac66d2d52\"},\"headline\":\"Using @ConfigurationProperties in Spring Boot\",\"datePublished\":\"2014-09-24T16:00:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html\"},\"wordCount\":456,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html\",\"name\":\"Using @ConfigurationProperties in Spring Boot\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2014-09-24T16:00:38+00:00\",\"description\":\"In my latest blog post I described shortly how one can configure mail in Spring Boot application. To inject properties into the configuration I used\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/09\\\/using-configurationproperties-in-spring-boot.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Using @ConfigurationProperties in Spring Boot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b1a0b2657d5dd2459806446ac66d2d52\",\"name\":\"Rafal Borowiec\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"caption\":\"Rafal Borowiec\"},\"description\":\"Software developer, Team Leader, Agile practitioner, occasional blogger, lecturer. Open Source enthusiast, quality oriented and open-minded.\",\"sameAs\":[\"http:\\\/\\\/blog.codeleak.pl\\\/\",\"http:\\\/\\\/pl.linkedin.com\\\/in\\\/borowiec\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/kolorobot\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/rafal-borowiec\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using @ConfigurationProperties in Spring Boot","description":"In my latest blog post I described shortly how one can configure mail in Spring Boot application. To inject properties into the configuration I used","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html","og_locale":"en_US","og_type":"article","og_title":"Using @ConfigurationProperties in Spring Boot","og_description":"In my latest blog post I described shortly how one can configure mail in Spring Boot application. To inject properties into the configuration I used","og_url":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-09-24T16:00:38+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Rafal Borowiec","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/kolorobot","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Rafal Borowiec","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html"},"author":{"name":"Rafal Borowiec","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b1a0b2657d5dd2459806446ac66d2d52"},"headline":"Using @ConfigurationProperties in Spring Boot","datePublished":"2014-09-24T16:00:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html"},"wordCount":456,"commentCount":2,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html","url":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html","name":"Using @ConfigurationProperties in Spring Boot","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2014-09-24T16:00:38+00:00","description":"In my latest blog post I described shortly how one can configure mail in Spring Boot application. To inject properties into the configuration I used","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2014\/09\/using-configurationproperties-in-spring-boot.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Using @ConfigurationProperties in Spring Boot"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b1a0b2657d5dd2459806446ac66d2d52","name":"Rafal Borowiec","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","caption":"Rafal Borowiec"},"description":"Software developer, Team Leader, Agile practitioner, occasional blogger, lecturer. Open Source enthusiast, quality oriented and open-minded.","sameAs":["http:\/\/blog.codeleak.pl\/","http:\/\/pl.linkedin.com\/in\/borowiec\/","https:\/\/x.com\/https:\/\/twitter.com\/kolorobot"],"url":"https:\/\/www.javacodegeeks.com\/author\/rafal-borowiec"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/30592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/516"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=30592"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/30592\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=30592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=30592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=30592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}