如何在 JUnit4 中使用 ClassRule 启动 Spring 引导服务器?

How to start Spring Boot server with ClassRule in JUnit4?

如我所见,org.springframework.test.context.junit4.rules.SpringClassRule 相当于 ClassRule 等同于 org.springframework.test.context.junit4.SpringJUnit4ClassRunner

但是,我想用 ClassRule 启动我的 整个 Spring 启动应用程序 。有没有类似 org.springframework.boot.test.contextSpringBootTest 作为 ClassRule 的东西?

有一个 GitHub 项目解决了这个问题:https://github.com/CarloWakefield/spring-boot-test-rule