gpt4 book ai didi

java - 如何使用 spring-ws 记录未处理的异常

转载 作者:行者123 更新时间:2023-12-01 23:36:40 25 4
gpt4 key购买 nike

Spring Web 服务 (spring-ws) 有一个默认的 SimpleSoapExceptionResolver,它将任何未处理的异常作为 SOAP 错误返回给客户端。这很好。

但是,我还希望它在服务器上记录异常,以便我们能够了解支持该服务。

SimpleSoapExceptionResolver 通过 AbstractEndpointExceptionResolver 有一个可以设置为启用日志记录的属性 (setWarnLogCategory)。

如何获取框架为了设置 warnLogCategory 属性而创建的 SimpleSoapExceptionResolver 实例的句柄?

谢谢,丹。

最佳答案

reference documentation说:

Endpoint exception resolvers are automatically picked up by the MessageDispatcher, so no explicit configuration is necessary.

因此只需实例化该类并设置属性即可:

<bean id="exceptionResolver" class="org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver">
<property name="warnLogCategory" value="com.mycompany.category"/>
</bean>

关于java - 如何使用 spring-ws 记录未处理的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18564688/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com