Add @Transactional to SimpleJobRepostory.stop()
This commit is contained in:
@@ -50,6 +50,7 @@ import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -355,6 +356,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* @see
|
||||
* org.springframework.batch.core.launch.JobOperator#stop(java.lang.Long)
|
||||
*/
|
||||
@Transactional
|
||||
public boolean stop(long executionId) throws NoSuchJobExecutionException {
|
||||
|
||||
JobExecution jobExecution = findExecutionById(executionId);
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
<config>src/main/resources/jobs/iosample/hibernate.xml</config>
|
||||
<config>src/main/resources/jobs/hibernateJob.xml</config>
|
||||
<config>src/main/resources/jobs/iosample/jpa.xml</config>
|
||||
<config>src/main/resources/jobs/iosample/ibatis.xml</config>
|
||||
<config>src/test/resources/org/springframework/batch/sample/JobOperatorFunctionalTests-context.xml</config>
|
||||
</configs>
|
||||
<configSets>
|
||||
<configSet>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.springframework.batch.sample;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.batch.core.BatchStatus.STARTED;
|
||||
import static org.springframework.batch.core.BatchStatus.STOPPED;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -11,7 +15,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import static org.springframework.batch.core.BatchStatus.*;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.core.configuration.ListableJobRegistry;
|
||||
@@ -22,7 +25,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration()
|
||||
@ContextConfiguration
|
||||
public class JobOperatorFunctionalTests {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(JobOperatorFunctionalTests.class);
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx">
|
||||
|
||||
|
||||
<import resource="classpath:/simple-job-launcher-context.xml" />
|
||||
<import resource="classpath:/jobs/infiniteLoopJob.xml" />
|
||||
|
||||
<tx:annotation-driven/>
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user