springwolf / springwolf-core

Automated documentation for event-driven applications built with Spring Boot
https://www.springwolf.dev
Apache License 2.0
253 stars 77 forks source link

Disabling springwolf breaks application #1073

Open nwwerum opened 22 hours ago

nwwerum commented 22 hours ago

Describe the bug When setting springwolf.enabled=false spring boot application with springwolf generic binding will not start anymore.

Dependencies and versions used 1.8, including springwolf.generic.binding

Code example Include generic binding jar in the classpath of a spring boot app and set springwolf.enabled=false

Stack trace and error logs

org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncGenericOperationBindingProcessor' defined in class path resource [io/github/springwolf/addons/generic_binding/annotation/configuration/SpringwolfGenericBindingAutoConfiguration.class]: Unsatisfied dependency expressed through method 'asyncGenericOperationBindingProcessor' parameter 0: No qualifying bean of type 'org.springframework.util.StringValueResolver' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Problem seems to be that SpringwolfGenericBindingAutoConfiguration does not react to the enabled property and will try to create its bean in any case, even if other springwolf beans (in this case StringValueResolverProxy) are not created.

An easy solution would be to add a @ConditionalOnBean(StringValueResolver.class) to the asyncGenericOperationBindingProcessor() method. Edit: other autoconfigs replicate the @ConditionalOnProperty (and do not use a @ConditionalOnBean), so it makes sense to handle this the same way.

github-actions[bot] commented 22 hours ago

Welcome to Springwolf. Thanks a lot for reporting your first issue. Please check out our contributors guide and feel free to join us on discord.

timonback commented 15 hours ago

Awesome, thank you for the contribution!

github-actions[bot] commented 15 hours ago

The change is staged for release and will be part of the next release.

If you want to try and verify it in your application today, use the latest 1.X.0-SNAPSHOT build as described in our README.md > Testing SNAPSHOT version

Thank you for the report/contribution!