问题
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