I have a simple Spring Boot application, consisting only of this class:
@SpringBootApplication
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
}
I want to test whether the application starts. That test looks like this:
@SpringBootTest
public class UserServiceIT {
@Test
public void testContextLoads() {
assertTrue(true);
}
}
When I run this test from my IDE (IntelliJ), it passes. This is the expected behavior.
When I run it from the command line ( mvn integration-test
), I get the following failure:
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
I'm using the following versions:
Any ideas as to why this fails on the command line?
I tried rolling back the version of maven-failsafe-plugin
to 3.0.0.M4
and the test passed from the command line. Therefore this appears to be a bug in 3.0.0.M5
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.