【发布时间】:2015-09-25 09:07:44
【问题描述】:
我在 application.properties 中尝试了spring.batch.job.enabled=false,在运行 jar 文件时尝试了-Dspring.batch.job.enabled=false。
但是@EnableBatchProcessing 在应用程序启动时自动开始运行批处理作业。我该如何调试这种情况?
TestConfiguration.class
@Configuration
@EnableBatchProcessing
public class TestConfiguration {...}
主应用程序
@ComponentScan("com.demo")
@EnableAutoConfiguration
public class MainApplication {
public static void main(String[] args) throws BeansException, JobExecutionAlreadyRunningException, JobInstanceAlreadyCompleteException, JobParametersInvalidException, InterruptedException, JobRestartException {
ConfigurableApplicationContext ctx = SpringApplication.run(TestConfiguration.class, args);
...}
pom.xml 我将依赖项用作弹簧启动而不是父项
<dependencyManagement>
<dependencies>
<!-- Import dependecy for spring boot from here-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
【问题讨论】:
标签: java spring spring-boot spring-batch