Jax-ws客户端springxmlbean配置到基于java的配置?
您能帮我将下面的spring基于xml的配置转换为基于java的bean配置吗Jax-ws客户端springxmlbean配置到基于java的配置?,java,spring,jax-ws,spring-java-config,Java,Spring,Jax Ws,Spring Java Config,您能帮我将下面的spring基于xml的配置转换为基于java的bean配置吗 <jaxws:client id="helloClient" serviceClass="demo.spring.HelloWorld" address="http://localhost:9002/HelloWorld" /> 您只需要在您的任何配置类中声明一个bean,并使用您所关心的属性。 它应该是这样的: @Bean(nam
<jaxws:client id="helloClient"
serviceClass="demo.spring.HelloWorld"
address="http://localhost:9002/HelloWorld" />
您只需要在您的任何配置类中声明一个bean,并使用您所关心的属性。 它应该是这样的:
@Bean(name = "helloClient") // this is the id
public HelloWorld helloWorld() {
String address = "http://localhost:9002/HelloWorld";
JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
factoryBean.setServiceClass(HelloWorld.class);
factoryBean.setAddress(address);
return (HelloWorld) factoryBean.create();
}
您的方法将返回服务类的对象。
您需要一个Jax代理工厂bean来设置属性,然后创建客户机(将其转换为您的服务类)并返回它