-2

My application is a Spring Boot + Jersey web app. I followed this official tutorial to integrate togglz with my Spring Boot application. I added the dependency togglz-spring-boot-starter to my project. But I always get below missing bean error when launching the Spring Boot application. According to the togglz spring-boot guide, it says this dependency should add all the missing beans into the application. What am I missing here?

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'togglzEndpoint' defined in class path resource [org/togglz/spring/boot/autoconfigure/TogglzAutoConfiguration$TogglzEndpointConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.togglz.core.manager.FeatureManager]: : Error creating bean with name 'featureManager' defined in class path resource [org/togglz/spring/boot/autoconfigure/TogglzAutoConfiguration$FeatureManagerConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.togglz.core.spi.FeatureProvider]: : No qualifying bean of type [org.togglz.core.spi.FeatureProvider] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.togglz.core.spi.FeatureProvider] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'featureManager' defined in class path resource [org/togglz/spring/boot/autoconfigure/TogglzAutoConfiguration$FeatureManagerConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.togglz.core.spi.FeatureProvider]: : No qualifying bean of type [org.togglz.core.spi.FeatureProvider] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.togglz.core.spi.FeatureProvider] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.togglz.core.spi.FeatureProvider] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

kryger
  • 12,906
  • 8
  • 44
  • 65
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
  • 1
    How did you configure the `FeatureProvider`? You have to define a `FeatureProvider` bean or set the `togglz.feature-enums` application property. See also http://www.togglz.org/documentation/spring-boot-starter.html section Auto Configuration. – Marcel Overdijk Mar 30 '16 at 10:22
  • He's already said he read that page, and that page says nothing about configuring a FeatureProvider for non-enum setup. It says `Alternatively, or additionally, the togglz.feature-enums application property can be provided to create features from one or more enum classes. You can also provide features through an explicit FeaturesProvider` - the page implies that this is only necessary if you use the enum, not the default setup. – orbfish Mar 30 '18 at 15:50

1 Answers1

1

Finally I figured out the issue, I have to add below code on the spring boot config class:

@Bean
public FeatureProvider featureProvider() {
    return new EnumBasedFeatureProvider(AppFeatures.class);
}
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523