{"id":75154,"date":"2018-03-23T07:00:09","date_gmt":"2018-03-23T05:00:09","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=75154"},"modified":"2018-03-22T11:03:34","modified_gmt":"2018-03-22T09:03:34","slug":"feature-toggle-in-spring-boot-2","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html","title":{"rendered":"Feature toggle in Spring Boot 2"},"content":{"rendered":"<p>Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil. There are several approaches which try to solve the challenge of effective integration. The feature toggle belongs to that group. In this article, you\u2019ll see in practice how feature toggles, also known as feature flags, can be used in your Spring Boot application. <ins><\/ins><\/p>\n<h2>1. What is feature toggle?<\/h2>\n<p>Simply put, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Feature_toggle\">Feature toggles<\/a> are variables which <strong>allow execution of alternative paths in an application<\/strong> based on their current values. By keeping different scenarios of execution, you can modify the behavior of the application without altering the code.<\/p>\n<p>Depending on your needs, toggles\u2019 values can be set before the startup of your application or adjusted at runtime. In the latter case, changes of a value can be persisted or affect only the current execution of the application.<\/p>\n<p>Usually, you read about feature flags as <strong>an alternative for feature source code branching<\/strong>, however, in practice both techniques can be used together. For instance, you can use feature branches for development of new user stories in the application, while feature toggles can be applied to control access to features on separate environments (e.g. clients with different\u00a0 requirements).<\/p>\n<p>Despite many uses, feature toggles have also their drawbacks. The biggest one is <strong>complexity<\/strong>. Without a proper strategy they can quickly get out of hand and become a maintenance nightmare. Fortunately, \u00a0if you follow several good practice and <a href=\"https:\/\/www.javacodegeeks.com\/2017\/07\/project-package-organization.html\">organize the application around features<\/a>, working with feature flags should be much simpler.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/toggles.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-75159\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/toggles.jpg\" alt=\"\" width=\"640\" height=\"425\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/toggles.jpg 640w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/toggles-300x199.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<h2>2. Selecting beans with feature toggle<\/h2>\n<p>The most common case for using feature toggles in a Spring Boot application is activating a different implementation of some interface based on a current value of a feature toggle. Let\u2019s examine an example to demonstrate described case.<\/p>\n<h3>2.1 Dependency abstraction<\/h3>\n<p>Imagine you have a web endpoint which returns a list of products fetched from a database repository. Your goal is to create a feature toggle that allows switching repository implementation to one that uses a web service as a data source.<\/p>\n<p>If the class you want to allow for feature toggling is directly used in other classes, the first thing you need to do is to abstract the dependency using an interface.<\/p>\n<p>The snippet below presents an example product REST endpoint which depends on a <i>ProductRepository<\/i> interface.<\/p>\n<pre class=\"brush:java\">@RestController\r\n@RequestMapping(\"\/products\")\r\nclass ProductController {\r\n\r\n   private final ProductRepository productRepository;\r\n\r\n   ProductController(ProductRepository productRepository) {\r\n       this.productRepository = productRepository;\r\n   }\r\n\r\n   @GetMapping\r\n   Collection&lt;Product&gt; getAll() {\r\n       return productRepository.findAll();\r\n   }\r\n\r\n}<\/pre>\n<p>At this moment, we have only one implementation of the interface. Soon we\u2019re going to add another one, which you\u2019ll activate with a feature toggle.<\/p>\n<pre class=\"brush:java\">@Repository\r\nclass DbProductRepository implements ProductRepository {\r\n    \/\/...\r\n}<\/pre>\n<h3>2.2 Feature toggle in application.properties<\/h3>\n<p>Since the <i>application.properties<\/i> file is used for configuration of your Spring Boot application, it\u2019s a great place for putting your feature toggle flag.<\/p>\n<pre class=\"brush:bash\">feature.toggles.productsFromWebService=true<\/pre>\n<p>Set the flag to false before committing the code. This way, by default your teammates will have the new feature disabled. If someone wants to activate the feature, their can change the flag value to true on the local development environment.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3>2.3 Conditional bean creation<\/h3>\n<p>Your next step is to create an alternative implementation of the interface that you want to activate with the feature toggle. In order to instantiate the bean based on the value of the created property, you can use Spring Boot annotation called <i>@ConditionalOnProperty<\/i>. Set the name of the toggle property and the value which should activate it. The value should be the same as the one placed in the <i>application.properties<\/i> file.<\/p>\n<pre class=\"brush:java\">@Repository\r\n@ConditionalOnProperty(\r\n       name = \"feature.toggles.productsFromWebService\",\r\n       havingValue = \"true\"\r\n)\r\nclass WebServiceProductRepository implements ProductRepository {\r\n    \/\/...\r\n}<\/pre>\n<p>Before you start your application, you have to disable the database repository, otherwise, you will get an exception about multiple active implementations of the interface. Return to the the first implementation and apply the following changes:<\/p>\n<pre class=\"brush:java\">@Repository\r\n@ConditionalOnProperty(\r\n       name = \"feature.toggles.productsFromWebService\",\r\n       havingValue = \"false\",\r\n       matchIfMissing = true\r\n)\r\nclass DbProductRepository implements ProductRepository {<\/pre>\n<p>We use the same feature toggle name as previously, only its value has changed. Setting the <i>matchIfMissing<\/i> property is optional. By doing this, if you remove the feature toggle form the <i>application.properties<\/i> file, this bean will be created even though the value is missing.<\/p>\n<h2>3. How to disable controller with feature toggle<\/h2>\n<p>You can apply the same strategy to conditionally activate a whole Spring web controller. You don\u2019t need to create an additional interface because there is only one implementation that you want to control with the feature toggle.<\/p>\n<pre class=\"brush:java\">@RestController\r\n@RequestMapping(\"\/coupons\")\r\n@ConditionalOnProperty(name = \"feature.toggles.coupons\", havingValue = \"true\")\r\nclass CouponController {\r\n  \/\/...\r\n}<\/pre>\n<p>The <i>application.properties<\/i> should contain the following line.<\/p>\n<pre class=\"brush:bash\">feature.toggles.coupons=true<\/pre>\n<p>When you don\u2019t set the value to true, the controller won\u2019t be instantiated by Spring. The client will simply receive the 404 HTTP status code.<\/p>\n<p><b>Unfortunately, the <i>@ConditionalOnProperty<\/i> annotation can\u2019t be used on a single <i>@RequestMapping<\/i> method.<\/b> As a workaround, you can move the desired mapping to a separate controller bean. Alternatively, it\u2019s possible to simply inject the value of the feature toggle and create an if statement in the body of the mapping method. However, you should use this solution with caution. If you\u2019re interested why you\u2019ll find the answer in the next paragraph.<\/p>\n<pre class=\"brush:java\">private final boolean couponsToggled;\r\n\r\nCouponController(@Value(\"${feature.toggles.coupons}\") boolean couponsToggled) {\r\n   this.couponsToggled = couponsToggled;\r\n}\r\n\r\n@GetMapping\r\nList&lt;String&gt; listCouponNames() {\r\n   if (!couponsToggled) {\r\n       throw new NotSupportedException();\r\n   }\r\n   \/\/...\r\n}<\/pre>\n<h2>4. Multiple feature toggle management<\/h2>\n<p>As you can read about <a href=\"https:\/\/martinfowler.com\/articles\/feature-toggles.html#ImplementationTechniques\">feature toggles on Martin Fowler\u2019s bliki<\/a>, <b>feature flags have a tendency to spread across the codebase and can quickly get unmanageable<\/b>. Even if you have just a few feature toggles in your application, it\u2019s better to abstract the storage of your flags from decision points in which they are used.<\/p>\n<h3>4.1 Avoiding feature flag coupling<\/h3>\n<p>The last code example from the previous paragraph uses the flag value injected directly from the <i>application.properties<\/i> file, therefore it doesn\u2019t abstract the storage. If you want to use the same flag in a different part of your application, you\u2019ll have to duplicate the injection.<\/p>\n<p>What you can do instead is to <b>put all feature toggle values inside a single class, which will act as a single source of truth<\/b>. Using a separate class gives you much more flexibility. For instance, you could replace the storage of flags with a database or implement a mechanism which allows switching flags at runtime.<\/p>\n<h3>4.2 Extracting feature toggle decisions in Spring Boot<\/h3>\n<p>Once you have a separate bean for your feature toggles, you can easily inject all flags from the <i>application.properties<\/i> file using the <a href=\"https:\/\/docs.spring.io\/autorepo\/docs\/spring-boot\/current\/api\/org\/springframework\/boot\/context\/properties\/ConfigurationProperties.html\">@ConfigurationProperties<\/a> annotation. Here you can see a sample implementation:<\/p>\n<pre class=\"brush:java\">@Component\r\n@Component\r\n@ConfigurationProperties(\"feature\")\r\npublic class FeatureDecisions {\r\n\r\n   private Map&lt;String, Boolean&gt; toggles = new HashMap&lt;&gt;();\r\n\r\n   public Map&lt;String, Boolean&gt; getToggles() {\r\n       return toggles;\r\n   }\r\n\r\n   public boolean couponEnabled() {\r\n       return toggles.getOrDefault(\"coupons\", false);\r\n   }\r\n\r\n}<\/pre>\n<p>The class above will take all properties which start with <i>feature.toggles<\/i> and put them in the <i>toggles<\/i> map. As you can see, there\u2019s a method called <i>couponEnabled()<\/i> which you can use to abstract a feature decision point from the logic behind that decision.<\/p>\n<p>In addition, you\u2019ll also need an extra dependency to enable processing for <i>@ConfigurationProperties<\/i>.<\/p>\n<pre class=\"brush:xml\">&lt;dependency&gt;\r\n   &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;spring-boot-configuration-processor&lt;\/artifactId&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<h2>5. Actuator endpoint for feature toggles<\/h2>\n<p>Since you already have all feature toggles in a single place, all you have to do now is to expose the list using a custom Actuator endpoint. The following example will show you how to do it.<\/p>\n<pre class=\"brush:java\">@Component\r\n@Endpoint(id = \"feature-toggles\")\r\nclass FeatureToggleInfoEndpoint {\r\n\r\n   private final FeatureDecisions featureDecisions;\r\n\r\n   FeatureToggleInfoEndpoint(FeatureDecisions featureDecisions) {\r\n       this.featureDecisions = featureDecisions;\r\n   }\r\n\r\n   @ReadOperation\r\n   public Map&lt;String, Boolean&gt; featureToggles() {\r\n       return featureDecisions.getToggles();\r\n   }\r\n\r\n}<\/pre>\n<p><b>If you work with the default Spring Boot 2 Actuator setup, the endpoint won\u2019t be exposed via HTTP<\/b>. In order to test it in your browser, you have to enable the Actuator endpoint by adding its identifier to <a href=\"https:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/html\/production-ready-endpoints.html#production-ready-endpoints-exposing-endpoints\">the web include filter<\/a> in your <i>application.properties<\/i> file.<\/p>\n<pre class=\"brush:bash\">management.endpoints.web.exposure.include=health,info,feature-toggles<\/pre>\n<p>Once you run your application, go to <a href=\"http:\/\/localhost:8080\/actuator\/feature-toggles\">http:\/\/localhost:8080\/actuator\/feature-toggles<\/a> to see the results returned by the endpoint:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/feature-toggles-endpoint-output.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-75160\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/feature-toggles-endpoint-output.png\" alt=\"\" width=\"500\" height=\"142\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/feature-toggles-endpoint-output.png 500w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/03\/feature-toggles-endpoint-output-300x85.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>Depending on your needs, you could also implement the possibility to switch feature toggles at runtime using <i>@WriteOperation<\/i> on the created endpoint. This example covers only the output part.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, you could learn about practical examples of feature toggles in a Spring Boot application. We started with a very basic sample in which the framework covers all the needs. After that, we write some custom code to complete more custom feature toggle requirements. We finished with the helpful Actuator endpoint for displaying the status of all feature flags in the application.<\/p>\n<p>You can find <a href=\"https:\/\/github.com\/danielolszewski\/blog\/tree\/master\/spring-boot-feature-toggle\">the working sample application in the Github repository<\/a>. If you like the post and find it useful, please share it with your followers. I\u2019m also looking forward to your questions and comments below the article.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Daniel Olszewski, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/dolszewski.com\/spring\/feature-toggle-spring-boot\/\" target=\"_blank\" rel=\"noopener\">Feature toggle in Spring Boot 2<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil. There are several approaches which try to solve the challenge of effective integration. The feature toggle belongs to that group. In this article, you\u2019ll see in practice how feature toggles, also known &hellip;<\/p>\n","protected":false},"author":3861,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30,1717],"class_list":["post-75154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring","tag-spring-boot-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Feature toggle in Spring Boot 2 - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil.\" \/>\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\/2018\/03\/feature-toggle-in-spring-boot-2.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Feature toggle in Spring Boot 2 - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.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=\"2018-03-23T05:00:09+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=\"Daniel Olszewski\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@daolszewski\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Olszewski\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html\"},\"author\":{\"name\":\"Daniel Olszewski\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/f2727a76059a91188524de49e1e397fb\"},\"headline\":\"Feature toggle in Spring Boot 2\",\"datePublished\":\"2018-03-23T05:00:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html\"},\"wordCount\":1346,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\",\"Spring Boot 2\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html\",\"name\":\"Feature toggle in Spring Boot 2 - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2018-03-23T05:00:09+00:00\",\"description\":\"Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.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\\\/2018\\\/03\\\/feature-toggle-in-spring-boot-2.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\":\"Feature toggle in Spring Boot 2\"}]},{\"@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\\\/f2727a76059a91188524de49e1e397fb\",\"name\":\"Daniel Olszewski\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/478137d4c1cdb34323c29f65310308ecaabeb98e1efdf179d47932b1ddb219d3?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/478137d4c1cdb34323c29f65310308ecaabeb98e1efdf179d47932b1ddb219d3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/478137d4c1cdb34323c29f65310308ecaabeb98e1efdf179d47932b1ddb219d3?s=96&d=mm&r=g\",\"caption\":\"Daniel Olszewski\"},\"description\":\"Daniel Olszewski is a software developer passionate about the JVM ecosystem and web development. He is an advocate of clean, maintainable, and well tested code\",\"sameAs\":[\"http:\\\/\\\/dolszewski.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/olszewskidaniel\\\/\",\"https:\\\/\\\/x.com\\\/daolszewski\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/daniel-olszewski\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Feature toggle in Spring Boot 2 - Java Code Geeks","description":"Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil.","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\/2018\/03\/feature-toggle-in-spring-boot-2.html","og_locale":"en_US","og_type":"article","og_title":"Feature toggle in Spring Boot 2 - Java Code Geeks","og_description":"Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil.","og_url":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-03-23T05:00:09+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":"Daniel Olszewski","twitter_card":"summary_large_image","twitter_creator":"@daolszewski","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Daniel Olszewski","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html"},"author":{"name":"Daniel Olszewski","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/f2727a76059a91188524de49e1e397fb"},"headline":"Feature toggle in Spring Boot 2","datePublished":"2018-03-23T05:00:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html"},"wordCount":1346,"commentCount":2,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring","Spring Boot 2"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html","url":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html","name":"Feature toggle in Spring Boot 2 - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2018-03-23T05:00:09+00:00","description":"Whether you like it or not, software development is a collaborative activity. Integration work has always been demonized and treated as necessary evil.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/03\/feature-toggle-in-spring-boot-2.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\/2018\/03\/feature-toggle-in-spring-boot-2.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":"Feature toggle in Spring Boot 2"}]},{"@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\/f2727a76059a91188524de49e1e397fb","name":"Daniel Olszewski","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/478137d4c1cdb34323c29f65310308ecaabeb98e1efdf179d47932b1ddb219d3?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/478137d4c1cdb34323c29f65310308ecaabeb98e1efdf179d47932b1ddb219d3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/478137d4c1cdb34323c29f65310308ecaabeb98e1efdf179d47932b1ddb219d3?s=96&d=mm&r=g","caption":"Daniel Olszewski"},"description":"Daniel Olszewski is a software developer passionate about the JVM ecosystem and web development. He is an advocate of clean, maintainable, and well tested code","sameAs":["http:\/\/dolszewski.com","https:\/\/www.linkedin.com\/in\/olszewskidaniel\/","https:\/\/x.com\/daolszewski"],"url":"https:\/\/www.javacodegeeks.com\/author\/daniel-olszewski"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/75154","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\/3861"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=75154"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/75154\/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=75154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=75154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=75154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}