What is the difference between @BeforeClass and Spring @TestExecutionListener beforeTestClass()
问题 What is the difference between using JUnit @BeforeClass and the Spring @TestExecutionListener beforeTestClass(TestContext testContext) "hook"? If there is a difference, which one to use under which circumstances? Maven Dependencies: spring-core:3.0.6.RELEASE spring-context:3.0.6.RELEASE spring-test:3.0.6.RELEASE spring-data-commons-core:1.2.0.M1 spring-data-mongodb:1.0.0.M4 mongo-java-driver:2.7.3 junit:4.9 cglib:2.2 Using JUnit @BeforeClass annotation: import org.junit.BeforeClass; import