我正在开发一个使用Spring Boot的应用程序,并且正在自动装配一个使用构造函数中的togglz库的bean。但是,出现以下错误:
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.
例如,我有以下bean
@Autowired
public Test(Dependency depedency) {
if (FeatureTest.TEST_FEATURE.isActive()) {
}
我有以下功能枚举类
public enum FeatureTest implements Feature {
@Label("TEST_FEATURE")
@Version("999.999")
@EnabledByDefault
TEST_FEATURE
public boolean isActive() {
return FeatureContext.getFeatureManager().isActive(this);
}
}
我试图像这样创建一个configuraton bean:
@Configuration
public class ToggleConfiguration {
@SuppressWarnings("unchecked")
@Bean
public FeatureProvider featureProvider() {
return new EnumBasedFeatureProvider(FeatureTest.class);
}
}
现在,我正在尝试创建FeatureManager bean,但不确定如何。
如果其他人有其他建议,请告诉我,谢谢您的帮助