This note is about the configuration of testing environment with Spring.
Dependency with Maven
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>{$version}</version>
</dependency>
Annotations above class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
"classpath*:*.xml"
})
@Transactional
Rollback
The test rolls back transaction for test context after testing. So do not worry when see nothing happens in database.
竟然无法拒绝你的打赏
