Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jax-ws客户端springxmlbean配置到基于java的配置?_Java_Spring_Jax Ws_Spring Java Config - Fatal编程技术网

Jax-ws客户端springxmlbean配置到基于java的配置?

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

您能帮我将下面的spring基于xml的配置转换为基于java的bean配置吗

<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来设置属性,然后创建客户机(将其转换为您的服务类)并返回它