【发布时间】:2020-09-21 06:53:05
【问题描述】:
我的 Spring Boot 应用程序实现了一个 SOAP 客户端,如下所述:
@Configuration
public class MyClientConfiguration {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
// this package must match the package in the <generatePackage> specified in pom.xml
marshaller.setContextPath("de.mypackage");
return marshaller;
}
@Bean
public MyClient myclient(Jaxb2Marshaller marshaller) {
MyClient client = new MyClient();
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}
取决于另一个属性 target 我需要使用不同的 URI 配置这个 MyClient 对象,例如
- 对于
target=1,客户端必须配置为使用setDefaultUri("http://uri-1") - 对于
target=2,客户端必须配置为使用setDefaultUri("http://uri-2")
我很难理解如何做到这一点。
【问题讨论】:
标签: spring spring-boot soap-client