{"id":94055,"date":"2019-07-14T15:00:59","date_gmt":"2019-07-14T12:00:59","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=94055"},"modified":"2019-07-11T11:58:38","modified_gmt":"2019-07-11T08:58:38","slug":"profiles-spring-boot-application","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html","title":{"rendered":"How to use profiles in Spring Boot Application"},"content":{"rendered":"<p>Hello Friends,<\/p>\n<p>In this tutorial,we will learn,how we can use profiles in a Spring Boot Application.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"640\" height=\"366\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Spring-Boot-Profiles.png\" alt=\"Spring Boot Application\" class=\"wp-image-94087\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Spring-Boot-Profiles.png 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Spring-Boot-Profiles-300x172.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>We will discuss following points in this tutorial :<\/p>\n<p><b>1. What is Spring Boot Profile and Why we need Profiling<\/b><\/p>\n<p><b>2. How to do Profiling in Spring Boot with Example<\/b><\/p>\n<p><b>3. How to set\/change the default profile<br \/><\/b><br \/><b>1. What is Spring Boot Profile and Why we need Profiling<\/b><br \/><b><br \/><\/b>Suppose,you are working on a Spring Boot Application.You have tested application locally on your machine by connecting to local database which is installed on your machine.Now you want to deploy this application on DEV environment and you have DEV database server as well where you have your database.<\/p>\n<p>Now while testing the application locally,in your application.properties file,you would have put details like database url,username,password which is for the local database which is installed on your machine,but once you move to DEV environment,you would like your application to talk to DEV database rather than local database.<\/p>\n<p>So what you can do is,you can change application.properties file with the details which are required to connect to the DEV database,commit the code and deploy it on DEV,but the problem now is this code will connect fine with DEV database but when you will try to execute this code from local,it would not work,because you have changed database details to DEV database.<\/p>\n<p>So again to make it work on your local,you will have to make changes in the application.properties which are required for local and execute the application.<\/p>\n<p>As you can see,there is lot of hustle involved here in shuffling between local and DEV.<\/p>\n<p>Now Imagine you have more environments like ST,ET(QA),PROD and you have to make changes manually all the times.It will be real nightmare.<\/p>\n<p>So what is the Solution?<\/p>\n<p>Spring Boot Profiles in Rescue!<\/p>\n<p>Spring Boot lets you externalize your application configuration so that you can work with same application code in different environments without you need to make changes.<\/p>\n<p>Spring Boot Profiles allow you to configure multiple application.properties file, per environment,so that when you are on local ,it will use local properties file,when you are on DEV it will use DEV properties file and so on ,without you as a programmer need to make any explicit changes in the code.<\/p>\n<p>So in general,if you some application properties which vary per environment,you can handle that with the help of Spring Profiles.<\/p>\n<p>Looks cool. Isn&#8217;t it :)<\/p>\n<p><b>2. How to do Profiling in Spring Boot with Example<\/b><\/p>\n<p><b>\u00a02.1<\/b>\u00a0Follow my\u00a0 post\u00a0 <a rel=\"noopener noreferrer\" href=\"https:\/\/javasolutionsguide.blogspot.com\/2018\/02\/how-to-create-spring-boot-project-with.html\" target=\"_blank\">How to Create a Spring Boot Project with Spring Initializer<\/a>\u00a0and create a Spring Boot project with name &#8220;Springbootprofiles&#8221;\u00a0.Add only web dependency,as that will be sufficient for our testing.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><b>2.2<\/b> In the application .properties file that has been automatically created by Spring intializer,add following line :<br \/>application.environment=This is a local Environment<\/p>\n<p><b>2.3 <\/b>Run the application by clicking on project and selecting Run as -&gt;Run Configurations -&gt; Run<\/p>\n<p><b>2.4 <\/b>Check console logs generated by Spring boot<\/p>\n<p>You will see following line in the logs&nbsp;<\/p>\n<p>2019-07-07 20:00:52.147&nbsp; INFO 15560 &#8212; [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;main] c.b.j.s.SpringbootprofilesApplication&nbsp; &nbsp; : No active profile set, falling back to default profiles: default<\/p>\n<p>Which basically is telling that we have not set any profile explicitly,so spring boot is using default profile,which in other words mean that Spring boot is using configurations from application.properties file.<\/p>\n<p>How can we check that?<\/p>\n<p>Let us see in the next steps.<\/p>\n<p><b>2.5 Create a controller with name ProfileController.java as folllows :<\/b><\/p>\n<pre class=\"wp-block-preformatted brush:java\">package com.blogspot.javasolutionsguide.springbootprofiles.controller;\n\nimport org.springframework.beans.factory.annotation.Value;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n\/**\n&nbsp;* @author javaSolutionsGuide\n&nbsp;*\n&nbsp;*\/\n@RequestMapping(\"\/v1\")\n@RestController\npublic class ProfileController {\n \n @Value(\"${application.environment}\")\n private String applicationEnv;\n \n @GetMapping\n public String getApplicationEnv() {\n  return applicationEnv;\n }\n\n}<\/pre>\n<p>Here basically,what we are trying to do is ,we are trying to access application.environment property defined in the application.properties file in our controller using @Value annotation,so that when we will hit this resource uri from browser ,we should get &#8220;This is a local Environment&#8221;.<\/p>\n<p><b>2.6<\/b> Let us start the application again by clicking on project and selecting Run as -&gt;Run Configurations -&gt; Run and then actually hit the resource URI(<br \/><a href=\"http:\/\/localhost:8080\/v1\">http:\/\/localhost:8080\/v1<\/a>) and see ,if it is returning the expected value from application.properties file.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"1024\" height=\"101\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Local_file-1024x101.jpg\" alt=\"\" class=\"wp-image-94088\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Local_file-1024x101.jpg 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Local_file-300x30.jpg 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Local_file-768x76.jpg 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/Local_file.jpg 1362w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n<p>So IT IS working as expected.<\/p>\n<p><b>Take Away : When we don&#8217;t set any profile in our spring boot application,by default it picks default profile which is none other than the default application.properties file.<\/b><\/p>\n<p><b>Note : If you want you can change default profile to some other properties file as well.We will see that later in this tutorial.<\/b><br \/><b><br \/><\/b><br \/><b>2.7\u00a0<\/b>Now say you want to deploy your code to DEV environment,so that you want your application to pick DEV specific properties when application is running on DEV and LOCAL environment specific properties when\u00a0 application is running\u00a0 on local.<\/p>\n<p>For that,what we need to do is create another properties file with name application-dev.properties.In general naming convention is application-{profile name}.properties&#8217;<\/p>\n<p>Where profile name is generally environment name,but it can be any text.<\/p>\n<p><b>2.8 <\/b>Let us add following line in application-dev.properties file<br \/>application.environment=This is a dev Environment<\/p>\n<p><b>2.9 <\/b>Now how to tell the application to use dev profile instead of default profile.<\/p>\n<p>For that,we need to set &#8220;spring.profiles.active&#8221;&nbsp;environment variable&nbsp; as below :<\/p>\n<p>spring.profiles.active = dev<\/p>\n<p>For setting that ,right click on project,select Run as -&gt; Run Configurations-&gt; Environment-&gt;New -&gt; Add Name as spring.profiles.active and Value as dev -&gt; click ok -&gt; Run<\/p>\n<p><b>2.10<\/b> If you will check logs now,you will find following line in the logs :<br \/><b><br \/><\/b> 2019-07-07 20:22:08.557\u00a0 INFO 17172 &#8212; [\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0main] c.b.j.s.SpringbootprofilesApplication\u00a0 \u00a0 : The following profiles are active: dev<\/p>\n<p>Which shows that dev profile is active now.<\/p>\n<p><b>2.11 <\/b>Let us test actually and see if our controller picks value from application-dev.properties<\/p>\n<p><b>2.12 <\/b>Hit the resource URI<b>(<\/b><a href=\"http:\/\/localhost:8080\/v1\">http:\/\/localhost:8080\/v1<\/a><b>) <\/b>and see the result on the browser<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"640\" height=\"51\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/dev.jpg\" alt=\"\" class=\"wp-image-94089\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/dev.jpg 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/dev-300x24.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p>And it is clear that ,this time value has been picked from application-dev.properties file.<\/p>\n<p><b>Take Away : We can have n number of properties files in our spring boot application for n number of environments,which will have configurations specific to that environment.All we have to do to use properties file in respective environment,is to set spring.profiles.active property to that environment and spring boot will pick respective properties file.<br \/><\/b><br \/><b>3. How to set\/change the default profile<\/b><br \/><b><br \/><\/b> As we saw above,by default ,spring boot picks the default profile which means it picks application.properties file.What if ,instead ,we want to make dev as our default profile.<\/p>\n<p>In that case all you need to do is remove spring.profiles.active and set spring.profiles.default property to the profile which we want to set as default profile&nbsp; as environment variable in eclipse.<\/p>\n<p>spring.profiles.default&nbsp; = dev<\/p>\n<p>Now,if you will re-run your application,you will see following line in your console logs :<\/p>\n<p>2019-07-07 20:35:23.587&nbsp; INFO 16832 &#8212; [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;main] c.b.j.s.SpringbootprofilesApplication&nbsp; &nbsp; : No active profile set, falling back to default profiles: dev<\/p>\n<p>So it is clear from above logs that dev is now treated as default profile.<\/p>\n<p>We can verify further by hitting our resource URI(<a href=\"http:\/\/localhost:8080\/v1\">http:\/\/localhost:8080\/v1<\/a>)<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"640\" height=\"51\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/dev-1.jpg\" alt=\"\" class=\"wp-image-94090\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/dev-1.jpg 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/07\/dev-1-300x24.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n<p><b>Take Away : If we don&#8217;t\u00a0set any profile as default profile,by default spring boot will pick configurations from application.properties file.If you want to make any other environment configurations as default,you can set spring.profiles.default property to that environmenta and<\/b><\/p>\n<p><b>spring boot will pick that environment specific property even when spring.profiles.active is not set<\/b><\/p>\n<p>Thanks for reading.Please share it with someone,you think this might be helpful.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Gaurav Bhardwaj, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/javasolutionsguide.blogspot.com\/2019\/07\/how-to-use-profiles-in-spring-boot.html\" target=\"_blank\" rel=\"noopener noreferrer\">How to use profiles in Spring Boot Application<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello Friends, In this tutorial,we will learn,how we can use profiles in a Spring Boot Application. We will discuss following points in this tutorial : 1. What is Spring Boot Profile and Why we need Profiling 2. How to do Profiling in Spring Boot with Example 3. How to set\/change the default profile1. What is &hellip;<\/p>\n","protected":false},"author":955,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[854],"class_list":["post-94055","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to use profiles in Spring Boot Application - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Spring Boot Application? Check our article explaining how to use profiles in a Spring Boot Application.\" \/>\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\/2019\/07\/profiles-spring-boot-application.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use profiles in Spring Boot Application - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Spring Boot Application? Check our article explaining how to use profiles in a Spring Boot Application.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.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=\"2019-07-14T12:00:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-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=\"Gaurav Bhardwaj\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gaurav Bhardwaj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html\"},\"author\":{\"name\":\"Gaurav Bhardwaj\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/58bd3e1f6edc1bed6a6374fe9a34ca37\"},\"headline\":\"How to use profiles in Spring Boot Application\",\"datePublished\":\"2019-07-14T12:00:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html\"},\"wordCount\":1333,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring Boot\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html\",\"name\":\"How to use profiles in Spring Boot Application - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2019-07-14T12:00:59+00:00\",\"description\":\"Interested to learn about Spring Boot Application? Check our article explaining how to use profiles in a Spring Boot Application.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/07\\\/profiles-spring-boot-application.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\":\"How to use profiles in Spring Boot Application\"}]},{\"@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\\\/58bd3e1f6edc1bed6a6374fe9a34ca37\",\"name\":\"Gaurav Bhardwaj\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"caption\":\"Gaurav Bhardwaj\"},\"description\":\"Gaurav has done Masters in Computer Applications(MCA) and is working in Software development field for more than 10 years in Java\\\/J2EE technologies. He is currently working with one of top MNC. He has worked on various frameworks like Struts, Spring, Spring Boot, Angular JS, JSF, Velocity, iBatis, MyBatis, Hibernate, JUnit, Mockito, Dozzer. He likes to explore new technologies and share his thoughts by writing a technical blog. He is the founder of JavaSolutionsGuide.blogspot.com.\",\"sameAs\":[\"http:\\\/\\\/www.javasolutionsguide.blogspot.nl\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/gaurav-bhardwaj\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use profiles in Spring Boot Application - Java Code Geeks","description":"Interested to learn about Spring Boot Application? Check our article explaining how to use profiles in a Spring Boot Application.","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\/2019\/07\/profiles-spring-boot-application.html","og_locale":"en_US","og_type":"article","og_title":"How to use profiles in Spring Boot Application - Java Code Geeks","og_description":"Interested to learn about Spring Boot Application? Check our article explaining how to use profiles in a Spring Boot Application.","og_url":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-07-14T12:00:59+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Gaurav Bhardwaj","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Gaurav Bhardwaj","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html"},"author":{"name":"Gaurav Bhardwaj","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/58bd3e1f6edc1bed6a6374fe9a34ca37"},"headline":"How to use profiles in Spring Boot Application","datePublished":"2019-07-14T12:00:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html"},"wordCount":1333,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring Boot"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html","url":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html","name":"How to use profiles in Spring Boot Application - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2019-07-14T12:00:59+00:00","description":"Interested to learn about Spring Boot Application? Check our article explaining how to use profiles in a Spring Boot Application.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/07\/profiles-spring-boot-application.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":"How to use profiles in Spring Boot Application"}]},{"@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\/58bd3e1f6edc1bed6a6374fe9a34ca37","name":"Gaurav Bhardwaj","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","caption":"Gaurav Bhardwaj"},"description":"Gaurav has done Masters in Computer Applications(MCA) and is working in Software development field for more than 10 years in Java\/J2EE technologies. He is currently working with one of top MNC. He has worked on various frameworks like Struts, Spring, Spring Boot, Angular JS, JSF, Velocity, iBatis, MyBatis, Hibernate, JUnit, Mockito, Dozzer. He likes to explore new technologies and share his thoughts by writing a technical blog. He is the founder of JavaSolutionsGuide.blogspot.com.","sameAs":["http:\/\/www.javasolutionsguide.blogspot.nl\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/gaurav-bhardwaj"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/94055","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\/955"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=94055"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/94055\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=94055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=94055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=94055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}