Can you help me convert following spring xml based configuration to java based configuration of beans?
<jaxws:client id="helloClient"
serviceClass="demo.spring.HelloWorld"
address="http://localhost:9002/HelloWorld" />
You just need to declare a bean in any of your configuration classes with the properties you have in your question. It should look something like this:
@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();
}
Your method will return an object of the Service class. You need a Jax proxy factory bean to set the properties and then create the client (cast it to your service class) and return it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With