2017-02-23 10 views
1

私はSpringブートアプリケーションにtogglzを統合しようとしましたが、Auto ConfigurationはFeatureManagerを提供するのが難しいと思われます。Togglz Spring Boot - 機能マネージャはありません

2017-02-23 16:04:30.033 DEBUG [myService,,,] 23359 --- [ restartedMain] org.togglz.core.context.FeatureContext : No cached FeatureManager for class loader: org.sprin[email protected]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 

アプリは最終的にはIllegalStateExceptionで死んで::以下は私のスタックトレースです

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] 

私は私のConfigurationクラスだけでなく、私のアプリのプロパティで定義されtogglz.enabled、私のtogglz.feature-enums性質を持っていますTogglzConfigを実装すると、SpringBootがトグルズの背後で何をしているのかは分かりません。他の誰かがこれを見つけたか、修正する方法を知っていますか?

  • 春のブート構成
  • 最小限の機能の列挙
  • のpom.xml

注使用している場合は春ブーツをまず

+0

あなたはコードとどのようにあなたがこれを設定しているを共有することができます:TSは、あなたが春のブート用に設定するために有益であるかもしれ

その他の特性にはフィーチャー? – xiumeteo

+0

コンストラクタにtogglz isActiveチェックを入れているので、発生しているようです。私はDocumentBuilder()コンストラクタを持っていて、そこにはDocumentBuilder()が他の場所でインスタンス化されているときに前述のエラーが発生するトグルチェックが行われます。 DocumentBuilderのtogglz isActiveチェックをbuild()メソッドに移すと、正常に動作します。 – deanmau5

+0

どのようにこれらのクラスを使用していますか、それらのコードを共有できますか? – xiumeteo

答えて

0

は、私はあなたが含まれるようにあなたの記事を更新をお勧めします次の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> 

そして、それが返す豆を定義するのと同じくらい簡単でなければなりません:

  • StateRepository
  • FeatureProvider
  • UserProvider

本の単純な実装は次のようになります。

@Bean 
public StateRepository getStateRepository() { 
    return new InMemoryStateRepository() 
} 

@Bean 
public FeatureProvider featureProvider() { 
    return new EnumBasedFeatureProvider(MyFeatures.class); 
} 

@Bean 
public UserProvider getUserProvider() { 
    return new NoOpUserProvider(); 
} 

MyFeatures.classは、実装する列挙型です

togglz.console.enabled=true 
togglz.console.secured=false 
関連する問題