Is there another way to get WebServiceTemplate in Spring Boot than WebServiceGatewaySupport#getWebServiceTemplate()?

孤街浪徒 提交于 2019-12-07 11:45:33

问题


Spring provides the org.springframework.ws.client.core.support.WebServiceGatewaySupport class, which is according to the Spring documentation a

convenient super class for application classes that need Web service access.

The class is apparently designed for extending. It is abstract so it cannot be instantiated as a bean, so I cannot use composition rather than inheritance.

However, when I inherit the class, Spring starts complaining like that:

[WARN] org.springframework.framework.CglibAopProxy - Unable to proxy interface-implementing method [public final void org.springframework.ws.client.core.support.WebServiceGatewaySupport.afterPropertiesSet() throws java.lang.Exception] because it is marked as final: Consider using interface-based JDK proxies instead!

Various resources (e.g. https://github.com/spring-projects/spring-boot/issues/8974) say something like

The warning is safe to ignore if you're not actually calling the xxx method through the proxy

however I am not happy having any warning in the application. It is generally not good to get used to ignore warnings, and furthermore some of our customers insist on the "zero-warning policy".

We need the class only for getting the WebServiceTemplate. We are using it somehow like that:

response = getWebServiceTemplate().marshalSendAndReceive(
               uri, request, new SoapActionCallback(soapAction));

QUESTION:

Is there an alternative way in Spring (actually, we use Spring Boot) to achieve the same result, without extra too much configuration and without warnings?

Maybe Spring has another class with the same functionality designed for composition? Or a static factory method?

来源:https://stackoverflow.com/questions/45277568/is-there-another-way-to-get-webservicetemplate-in-spring-boot-than-webservicegat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!