如何解决查找和DI定义一个具体的org.springframework.web.reactive.function.client.WebClient
如何注册以下接口的CONCRETE实现(通过applicationcontext.xml)(xml配置)?
org.springframework.web.reactive.function.client.WebClient
“指定的类是接口”
public interface WebClient
完整代码
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.reactive.function.client.WebClient;
import javax.inject.Inject;
public class MyClientProxy implements IMyClientProxy {
private final WebClient webClient;
private static Logger LOGGER;
public MyClientProxy(Logger lgr,WebClient webClient) {
if (null == lgr) {
throw new IllegalArgumentException("Logger is null");
}
this.LOGGER = lgr;
if (null == webClient) {
throw new IllegalArgumentException("WebClient is null");
}
this.webClient = webClient;
}
}
进口
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-webflux
compile group: 'org.springframework.boot',name: 'spring-boot-starter-webflux',version: '2.3.1.RELEASE'
显然,这不起作用
(来自applicationcontext.xml)
<bean id="zzzWebClientBean"
class="org.springframework.web.reactive.function.client.WebClient">
</bean>
但是在“我尝试了什么”类别中。...
解决方法
好的,这是一种工厂静态方法。
<bean id="zzzWebClientBean"
class="org.springframework.web.reactive.function.client.WebClient" factory-method="create">
</bean>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。