我在 Spring Boot 的帮助下使用 Apache CXFcxf-spring-boot-starter-jaxws
3.2.7版本的插件。
我的目的是自定义日志拦截器,但是当我创建以下类时:
public class CustomLoggingInInterceptor extends org.apache.cxf.interceptor.LoggingInInterceptor {}
但我的 IDE 删除了 LoggingInInterceptor 并抱怨它已被弃用,并给出了解释
使用日志记录模块 rt/features/logging 代替
那么应该如何使用该模块自定义日志拦截器呢?
此消息告诉您的是,使用Apache CXF Advanced logging feature
module.
它的依赖是(最新版本)
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-logging</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
在里面你会发现一个类似的org.apache.cxf.ext.logging.LoggingInInterceptor
(link https://cxf.apache.org/javadoc/latest/org/apache/cxf/ext/logging/LoggingInInterceptor.html)
我不是 CXF 用户,但我想您必须与JaxWsProxyFactoryBean
.
请记住,您需要对所有 CXF 模块使用相同的版本。
抓住它后,你可以做
factory.getInInterceptors().add(new MyCustomInterceptor());
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)