I have an application using Spring MVC 4, and not using any spring-boot-starter-* dependencies. ie, I don't have that class with a main method calling SpringApplication.run
. I'm configuring all by myself with xml and other @Configuration
classes.
Question : Is it possible to configure Spring Boot Test (using the spring-boot-starter-test) in that non Spring Boot Application?
spring-boot-starter-test has dependency on spring-boot-test JAR . There are some spring-boot
packages used. So if you wouldn't use these features, you may be able to use it as pure test dependency. But better alternative would be to use plain spring-test
module. That covers most of the Spring test functionality anyway.
spring-boot-starter-test has all you need, but it is dependency that you need to have, it will give you all power from spring-boot side, ie if you have your test class annotated with
@RunWith(SpringRunner.class)
@@SpringBootTest(
classes = ${YourMainClass}.class
)
it should work, even though I would strongly recommend using whole power of Spring Boot framework with the usage of all proper dependencies.
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.