gpt4 book ai didi

java - Togglz jetty9 嵌入

转载 作者:行者123 更新时间:2023-12-01 14:11:54 30 4
gpt4 key购买 nike

如何运行嵌入了 jetty 9 的 togglz。我尝试使用以下代码

        ServletHolder togglz = new ServletHolder(TogglzConsoleServlet.class);
togglz.setInitParameter("org.togglz.core.manager.TogglzConfig", "com.citronium.togglz.config.PlansteryTogglzConfig");
togglz.setInitParameter("org.togglz.FEATURE_MANAGER_PROVIDED", "true");
context.addServlet(togglz, "/togglz/*");
EnumSet<DispatcherType> all = EnumSet.of(DispatcherType.ASYNC, DispatcherType.ERROR, DispatcherType.FORWARD,
DispatcherType.INCLUDE, DispatcherType.REQUEST);
context.addFilter(new FilterHolder(new TogglzFilter()), "/togglz/*", all);

我有跟随错误

o.e.j.u.component.AbstractLifeCycle - FAILED o.e.j.s.ServletContextHandler@6195bb34{/,null,STARTING}: java.lang.IllegalStateException: Could not find any implementation of TogglzConfig or TogglzBootstrap. Please make sure that you have added the required integration modules to your project or register the implementation in your web.xml as described in the 'Configuration' chapter of the documentation. java.lang.IllegalStateException: Could not find any implementation of TogglzConfig or TogglzBootstrap. Please make sure that you have added the required integration modules to your project or register the implementation in your web.xml as described in the 'Configuration' chapter of the documentation.

最佳答案

我认为您应该将 org.togglz.FEATURE_MANAGER_PROVIDED 设置为 false。将其设置为 true 告诉 Togglz 它不应该使用 TogglzConfig 实现来引导 FeatureManager,而是尝试使用 IoC 容器(如 Spring 或 CDI)提供的 FeatureManager。

顺便说一句:您还应该将 TogglzFilter 的映射更改为 /*,以便 Togglz 适用于所有请求,而不仅仅是以 开头的 URL 的请求/togglz.

关于java - Togglz jetty9 嵌入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18457727/

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