1. // Controller
    2. @Target(ElementType.TYPE)
    3. @Retention(RetentionPolicy.RUNTIME)
    4. @ContextHierarchy({
    5. @ContextConfiguration(name = "parent", locations = {"classpath:spring-context.xml", "classpath:spring-mybatis.xml"}),
    6. @ContextConfiguration(name = "child", locations = "classpath:spring-mvc.xml")
    7. })
    8. @WebAppConfiguration(value = "src/main/webapp")
    9. @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
    10. @Transactional
    11. public @interface ControllerTest {
    12. }
    13. // Service
    14. @Target(ElementType.TYPE)
    15. @Retention(RetentionPolicy.RUNTIME)
    16. @ContextConfiguration({"classpath:spring-context.xml"})
    17. @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
    18. @Transactional
    19. public @interface ServiceTest {
    20. }