Spring提供了org.springframework.ws.client.core.support.WebServiceGatewaySupport
类,它根据Spring documentation a
方便的超类,适用于需要Web服务访问的应用程序类。
该课程显然专为扩展而设计。它是abstract
所以它不能被实例化为bean,所以我不能使用composition rather than inheritance。
然而,当我继承这个类时,Spring开始抱怨:
[WARN] org.springframework.framework.CglibAopProxy - 无法代理接口实现方法 [public final void org.springframework.ws.client.core.support.WebServiceGatewaySupport.afterPropertiesSet()throws java.lang.Exception] 因为它被标记为最终:考虑使用基于接口的JDK代理!
各种资源(例如https://github.com/spring-projects/spring-boot/issues/8974)说出类似
的内容如果您没有通过代理实际调用xxx方法,则可以放弃警告
然而,我很高兴在应用程序中发出任何警告。一般 不习惯忽视警告,而且我们的一些客户坚持采用零警告政策"。
我们只需要获取WebServiceTemplate
的课程。我们正在以某种方式使用它:
response = getWebServiceTemplate().marshalSendAndReceive(
uri, request, new SoapActionCallback(soapAction));
Spring中是否有另一种方法(实际上,我们使用 Spring Boot )来实现相同的结果,没有额外的太多配置和没有警告?
也许Spring有另一个具有为合成设计的相同功能的类?还是静态工厂方法?