Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchBeanDefinitionException with starter-web, starter-webflux and spring.main.web-application-type=reactive #13977

Closed
kklorenzotesta opened this issue Aug 1, 2018 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@kklorenzotesta
Copy link

Spring boot version: 2.0.4.RELEASE
Java versione: 9.0.4

I'm trying to create a project with both spring-boot-starter-web and spring-boot-starter-webflux. If in my application.properties I declare spring.main.web-application-type=reactive then at runtime a bean of type ErrorAttributes is missing and this exception is thrown:

2018-08-01 21:47:48.854  WARN 17460 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start reactive web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'httpHandler' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/HttpHandlerAutoConfiguration$AnnotationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.server.reactive.HttpHandler]: Factory method 'httpHandler' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.web.server.adapter.WebHttpHandlerBuilder$SortedBeanContainer': Unsatisfied dependency expressed through method 'setExceptionHandlers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'errorWebExceptionHandler' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/error/ErrorWebFluxAutoConfiguration.class]: Unsatisfied dependency expressed through method 'errorWebExceptionHandler' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.web.reactive.error.ErrorAttributes' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2018-08-01 21:47:48.862  INFO 17460 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-08-01 21:47:49.022 ERROR 17460 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method errorWebExceptionHandler in org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration required a bean of type 'org.springframework.boot.web.reactive.error.ErrorAttributes' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.boot.web.reactive.error.ErrorAttributes' in your configuration.

To replicate the issue I attached a minimal gradle project:
error-attribute.zip

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 1, 2018
@mbhave mbhave added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 2, 2018
@mbhave mbhave added this to the 2.0.x milestone Aug 2, 2018
@snicoll
Copy link
Member

snicoll commented Aug 2, 2018

FTR this bug is present in 2.0.0.RELEASE already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants