From f910b8ac9ada2aedc8da69375279730dcb194342 Mon Sep 17 00:00:00 2001 From: h_sharifi Date: Wed, 12 Oct 2022 13:42:37 +0330 Subject: [PATCH] #BAEL-3176: add "spring" Profile --- spring-batch/src/main/java/com/baeldung/batch/App.java | 2 ++ .../src/main/java/com/baeldung/batch/SpringBatchConfig.java | 2 ++ spring-batch/src/main/java/com/baeldung/batch/SpringConfig.java | 2 ++ 3 files changed, 6 insertions(+) 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")