我在互联网和堆栈溢出上进行了搜索,但似乎无法找到解决我的问题的方法:
Unable to find bean reference for type 'class com.consol.citrus.http.client.HttpClient'Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.consol.citrus.http.client.HttpClient' available: expected single matching bean but found 2: server1BasicAuthClient,server2BasicAuthClient
Run Code Online (Sandbox Code Playgroud)
概述一些背景信息:我必须使用 Spring 5 和 Citrus Framework 制作一个小型应用程序来自动化我们的集成测试。
我定义为遵循我的 Beans:
@Configuration
public class EndpointAuthentication {
public String server1Host;
public int server1Port;
public String server2Host;
public int server2Port;
@Bean(name="server1BasicAuthClient")
public com.consol.citrus.http.client.HttpClient server1BasicAuthClient() throws Exception {
return CitrusEndpoints.http()
.client()
.requestUrl(String.format("http://%s:%s/", server1Host, server1Port))
.requestFactory(sslRequestFactory(server1Host,server1Port))
.build();
}
@Bean(name="server2BasicAuthClient")
public com.consol.citrus.http.client.HttpClient server2BasicAuthClient() throws Exception {
return CitrusEndpoints.http()
.client()
.requestUrl(String.format("http://%s:%s/", …Run Code Online (Sandbox Code Playgroud)