Reputation: 36984
I have this class
@TransactionConfiguration(defaultRollback = false)
public class CandidateServiceTest extends AbstractServiceTest {
@Test
public void add() {
}
}
@ContextConfiguration(locations = { "classpath:/test/BeanConfig.xml" })
public class AbstractServiceTest extends AbstractTransactionalJUnit4SpringContextTests{
...
}
There are exist way that method add()
was not transactional ?
Upvotes: 0
Views: 1769
Reputation: 136022
You can annotate a test method with org.springframework.test.annotation.Rollback
annotation with true or false arg
Upvotes: 0
Reputation: 15992
You can use the @NotTransactional
annotation.
@TransactionConfiguration(defaultRollback = false)
public class CandidateServiceTest extends AbstractServiceTest {
@Test
@NotTransactional
public void add() {
...
}
}
EDIT
Since @NotTransactional
is deprecated, Spring documentation suggests that you split the transactional and non-transactional tests in different classes.
Upvotes: 2