package net.safedata.springboot.training.d03.s01;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.embedded.EmbeddedServletContainer;
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * Spring {@link Configuration} which loads some beans conditionally
 *
 * @author bogdan.solga
 */
@Configuration
public class ConditionalBeansConfig {

    @Bean
    @ConditionalOnClass(DataSource.class)
    public String conditionalOnClass() {
        return "Conditional on the DataSource class";
    }

    @Bean
    @ConditionalOnProperty(name = "matching.property", havingValue = "true")
    public String conditionalOnProperty() {
        return "Conditional on a property";
    }

    @Bean
    @ConditionalOnProperty(name = "used.webserver", havingValue = "jetty")
    public EmbeddedServletContainer jetty() {
        return new JettyEmbeddedServletContainer(null, true);
    }

    // a 'feature toggle' sample approach
    @Bean
    @ConditionalOnProperty(name = "cool.feature", havingValue = "enabled")
    public Object coolFeature() {
        return new Object();
    }
}

@@ -44,16 +44,56 @@
 3.s01;%0A%0A
+import org.eclipse.jetty.server.Server;%0A
 import o
@@ -897,36 +897,79 @@
 rty(
-name = %22matching.property%22, 
+%0A            name = %22enable.important.and.experimental.feature%22,%0A    %09%09
 havi
@@ -984,16 +984,18 @@
 = %22true%22
+%0A%09
 )%0A    pu
@@ -1028,24 +1028,108 @@
 roperty() %7B%0A
+        System.out.println(%22Enabling our important %5Band experimental%5D feature...%22);%0A
         retu
@@ -1196,32 +1196,39 @@
 ionalOnProperty(
+%0A    %09%09
 name = %22used.web
@@ -1235,17 +1235,23 @@
 server%22,
- 
+%0A    %09%09
 havingVa
@@ -1263,16 +1263,18 @@
  %22jetty%22
+%0A%09
 )%0A    pu
@@ -1367,11 +1367,23 @@
 er(n
-ull
+ew Server(9999)
 , tr
@@ -1473,16 +1473,29 @@
 roperty(
+%0A            
 name = %22
@@ -1508,16 +1508,28 @@
 eature%22,
+%0A           
  havingV
@@ -1544,16 +1544,21 @@
 enabled%22
+%0A    
 )%0A    pu

Split the conditional annotations on new lines