Helidon 中的球衣未选取库中定义的类

问题描述 投票:0回答:1

我目前使用的是helidon 4.0.5

我有一个库 com.example.library,其中有一些类,例如

@Provider
public class LoggingRequestFilter implements ContainerRequestFilter{
    
    
    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        System.out.print("FILTERER");
        
    }

}

我正在尝试在 helidon 启动应用程序中导入此库,但 jax-rs 没有选择过滤器。

如果我在 helidon 启动应用程序中编写相同的过滤器,它就可以正常工作。

jersey jax-rs microprofile helidon
1个回答
0
投票

在依赖项 jar 库中添加 beans.xml,以便它将处理 @Provider 注释。如果依赖项 jar 中没有 beans.xml,CDI 将不会处理注释。 Helidon 使用 CDI 来选择提供程序,因此包含过滤器的 jar 必须是 bean jar(因此它必须具有 beans.xml)。

© www.soinside.com 2019 - 2024. All rights reserved.