我使用默认的Tomcat嵌入式容器.但是,在我的一些测试中,我使用Wiremock(在下面使用Jetty).这使我的集成测试针对Jetty服务器而不是Tomcat运行.
有没有办法强迫Spring Boot坚持使用Tomcat?
有假装客户介绍:
@FeignClient(name = "storeClient", url = "${feign.url}")
public interface StoreClient {
//..
}
Run Code Online (Sandbox Code Playgroud)
是否可以利用环境更改的Spring Cloud功能在运行时更改Feign url?(更改feign.url属性并调用/refresh端点)
我正在研究自定义 Spring Boot 启动器。在测试启动器中,我想要做的是实现一个组合注释,它将@Configuration向 中添加其他类ApplicationContext(并且可能在 中使用此注释TestExecutionListener)。前任:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@ContextConfiguration(classes = AdditionalTestConfiguration.class)
public @interface ComposedAnnotation {
}
Run Code Online (Sandbox Code Playgroud)
并在我的 Spring Boot 集成测试中使用它:
@RunWith(SpringJUnit4ClassRunner.class)
@WebIntegrationTest
@SpringApplicationConfiguration(Application.class)
@ComposedAnnotation
public class SomeTest {
}
Run Code Online (Sandbox Code Playgroud)
不涉及继承。不幸的是,它似乎不起作用。我怀疑这是 Spring Boot 的问题,而不是 Spring 测试框架本身。
有什么办法可以达到预期的效果吗?