我正試圖查找是否可以在非web應用程序中使用togglz - 就像我們有普通的java項目或java批處理程序一樣。是否有可能在非web應用程序中使用togglz
我嘗試在獨立應用程序中添加togglz庫並嘗試運行它。
這是我的代碼片段 -
import com.feature.MyFeature;
public class Test {
public static void main(String[] args) {
Test t = new Test();
boolean valid=t.validate("CREATE_TEAM");
System.out.println(valid);
}
public boolean validate(String feature){
if (MyFeature.valueOf(feature).isActive()) {
return true;
}
return false;
}
}
它說 -
Exception in thread "main" 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 com.amdocs.switchlite.core.context.FeatureContext.getFeatureManager(FeatureContext.java:53)
at com.feature.MyFeature.isActive(MyFeature.java:20)
at Test.validate(Test.java:22)
at Test.main(Test.java:12)
我們可以看到你的pom.xml嗎?什麼是依賴使用?我們也可以看到你的togglz配置。 – 2017-02-17 12:00:02