阻止允许blocking不与Junit5一起工作

发布于 2025-01-30 15:44:29 字数 406 浏览 6 评论 0原文

我正在使用BlockHound来检测阻止呼叫,我想允许我的自定义方法,但它不起作用,并且仍然丢弃错误。

我将使用junit5与blockhound-junit-platform一起使用,我可以看到呼叫在控制台上打印,但仍在抛出异常。

@BeforeAll
        static void configureBlockHound(){
                System.out.println("called");
                BlockHound.builder().allowBlockingCallsInside(JWTHelper.class.getName(), "toToken").install();
        }

我正在运行测试时,

I am using blockhound to detect blocking calls, I would like to allow my custom methods but its not working and still throwing error.

i am using junit5 with blockhound-junit-platform

@BeforeAll
        static void configureBlockHound(){
                System.out.println("called");
                BlockHound.builder().allowBlockingCallsInside(JWTHelper.class.getName(), "toToken").install();
        }

When i run the test i can see called printed on console but still throwing exception.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫﹏色ふ单纯 2025-02-06 15:44:29

首先尝试以“仅对”模式运行阻止猎犬以了解根本原因。

BlockHound.install(builder -> builder
        .blockingMethodCallback(method -> 
                log.error("[{}] Blocking call: {}", Thread.currentThread(), method))
);

Try to run blockhound in "log-only" mode first to understand the root cause.

BlockHound.install(builder -> builder
        .blockingMethodCallback(method -> 
                log.error("[{}] Blocking call: {}", Thread.currentThread(), method))
);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文