diff --git a/spring-batch/src/main/java/com/baeldung/batch/App.java b/spring-batch/src/main/java/com/baeldung/batch/App.java index 0f888a77b3..c2db446965 100644 --- a/spring-batch/src/main/java/com/baeldung/batch/App.java +++ b/spring-batch/src/main/java/com/baeldung/batch/App.java @@ -8,7 +8,9 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.launch.JobLauncher; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Profile; +@Profile("spring") public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); diff --git a/spring-batch/src/main/java/com/baeldung/batch/SpringBatchConfig.java b/spring-batch/src/main/java/com/baeldung/batch/SpringBatchConfig.java index e1c52e1582..5546df22fc 100644 --- a/spring-batch/src/main/java/com/baeldung/batch/SpringBatchConfig.java +++ b/spring-batch/src/main/java/com/baeldung/batch/SpringBatchConfig.java @@ -23,12 +23,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Profile; import org.springframework.core.io.Resource; import org.springframework.oxm.Marshaller; import org.springframework.oxm.jaxb.Jaxb2Marshaller; import java.text.ParseException; +@Profile("spring") public class SpringBatchConfig { @Autowired private JobBuilderFactory jobBuilderFactory; diff --git a/spring-batch/src/main/java/com/baeldung/batch/SpringConfig.java b/spring-batch/src/main/java/com/baeldung/batch/SpringConfig.java index 73a07482ce..dc6c242996 100644 --- a/spring-batch/src/main/java/com/baeldung/batch/SpringConfig.java +++ b/spring-batch/src/main/java/com/baeldung/batch/SpringConfig.java @@ -13,6 +13,7 @@ import org.springframework.batch.support.transaction.ResourcelessTransactionMana import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; import org.springframework.core.io.Resource; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.init.DataSourceInitializer; @@ -21,6 +22,7 @@ import org.springframework.transaction.PlatformTransactionManager; @Configuration @EnableBatchProcessing +@Profile("spring") public class SpringConfig { @Value("org/springframework/batch/core/schema-drop-sqlite.sql")