Java Togglz Spring启动-未提供功能管理器

Java Togglz Spring启动-未提供功能管理器,java,spring-boot,togglz,Java,Spring Boot,Togglz,我曾尝试将togglz集成到我的Spring Boot应用程序中,但看起来自动配置很难提供FeatureManager。以下是我的堆栈跟踪: 2017-02-23 16:04:30.033 DEBUG [myService,,,] 23359 --- [ restartedMain] org.togglz.core.context.FeatureContext : No cached FeatureManager for class loader: org.springframework.

我曾尝试将togglz集成到我的Spring Boot应用程序中,但看起来自动配置很难提供FeatureManager。以下是我的堆栈跟踪:

2017-02-23 16:04:30.033 DEBUG [myService,,,] 23359 --- [  restartedMain] org.togglz.core.context.FeatureContext   : No cached FeatureManager for class loader: org.springframework.boot.devtools.restart.classloader.RestartClassLoader@6b8005f1
2017-02-23 16:05:57.403 DEBUG [myService,,,] 23359 --- [  restartedMain] org.togglz.core.context.FeatureContext   : Found 5 FeatureManagerProvider implementations...
2017-02-23 16:06:27.652 DEBUG [myService,,,] 23359 --- [  restartedMain] org.togglz.core.context.FeatureContext   : No FeatureManager provided by org.togglz.core.context.ThreadLocalFeatureManagerProvider
2017-02-23 16:06:36.436 DEBUG [myService,,,] 23359 --- [  restartedMain] org.togglz.core.context.FeatureContext   : No FeatureManager provided by org.togglz.core.context.BeanFinderFeatureManagerProvider
2017-02-23 16:06:45.980 DEBUG [myService,,,] 23359 --- [  restartedMain] org.togglz.core.context.FeatureContext   : No FeatureManager provided by org.togglz.core.context.StaticFeatureManagerProvider
2017-02-23 16:06:51.164 DEBUG [myService,,,] 23359 --- [  restartedMain] org.togglz.core.context.FeatureContext   : No FeatureManager provided by org.togglz.core.context.ContextClassLoaderFeatureManagerProvider
2017-02-23 16:06:55.980 DEBUG [myService,,,] 23359 --- [  restartedMain] o.t.c.c.JNDIFeatureManagerProvider       : FeatureMananger not found: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
2017-02-23 16:06:57.990 DEBUG [myService,,,] 23359 --- [  restartedMain] org.togglz.core.context.FeatureContext   : No FeatureManager provided by org.togglz.core.context.JNDIFeatureManagerProvider
随着应用程序最终因非法状态异常而消亡:

Caused by: java.lang.IllegalStateException: Could not find the FeatureManager. For web applications please verify that the TogglzFilter starts up correctly. In other deployment scenarios you will typically have to implement a FeatureManagerProvider as described in the 'Advanced Configuration' chapter of the documentation.
    at org.togglz.core.context.FeatureContext.getFeatureManager(FeatureContext.java:53) ~[togglz-core-2.3.0.Final.jar:na]

我在我的应用程序属性中定义了
togglz.enabled
togglz.feature enum
属性,以及我创建的实现TogglzConfig的配置类,似乎Spring Boot在幕后用togglz做的任何事情都不太管用。是否有其他人遇到过此问题或知道如何解决此问题?

首先,我建议您更新您的帖子,包括:

  • Spring引导配置
  • 最小特征枚举
  • pom.xml
注意:如果使用spring boot,则应使用以下GAV:

<dependency>
    <groupId>org.togglz</groupId>
    <artifactId>togglz-spring-boot-starter</artifactId>
    <version>2.4.1.Final</version>
</dependency>
<dependency>
    <groupId>org.togglz</groupId>
    <artifactId>togglz-console</artifactId>
    <version>2.4.1.Final</version>
</dependency>
其中MyFeatures.class是实现功能的枚举

其他可能有利于您为spring boot设置的属性包括:

togglz.console.enabled=true
togglz.console.secured=false

你能分享你的代码和你是如何设置的吗?它看起来像是在我在一个构造函数中进行togglz isActive检查时发生的。我有一个DocumentBuilder()构造函数,在这里我做了一个切换检查,当DocumentBuilder()在别处被实例化时,前面提到的错误就会发生。如果我将togglz isActive检查移到DocumentBuilder中的build()方法,一切正常。您如何使用这些类,能否共享这些代码块?
togglz.console.enabled=true
togglz.console.secured=false