Skip to content

OpenApiResource should not require reactive RequestMappingInfoHandlerMapping #19

Closed

Description

@kodyrecords

OpenApiResource controller requires org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping from reactive package.

Problem: when the application is deployed to a standalone tomcat server (which is a org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type.SERVLET type), then the application won't start with following error:

[][] 2019-08-05 15:54:46,720 WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'openApiResource': Unsatisfied dependency expressed through field 'requestMappingHandlerMapping'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
[][] 2019-08-05 15:54:46,910 ERROR o.s.b.d.LoggingFailureAnalysisReporter: 

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

Description:

Field requestMappingHandlerMapping in org.springdoc.api.OpenApiResource required a bean of type 'org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)

The following candidates were found but could not be injected:
	- Bean method 'cloudFoundryWebFluxEndpointHandlerMapping' in 'ReactiveCloudFoundryActuatorAutoConfiguration' not loaded because not a reactive web application
	- Bean method 'webEndpointReactiveHandlerMapping' in 'WebFluxEndpointManagementContextConfiguration' not loaded because not a reactive web application
	- Bean method 'controllerEndpointHandlerMapping' in 'WebFluxEndpointManagementContextConfiguration' not loaded because not a reactive web application


Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping' in your configuration.

The question is: why is WebMvcAutoConfiguration.EnableWebMvcConfiguration.requestMappingHandlerAdapter() autowiring the RequestMappingHandlerAdapter correctly in a tomcat standalone environment (eg during dev inside the IDE), but not on a standalone tomcat (9.x)?

Activity

  1. kodyrecords commented on Aug 5, 2019

    @kodyrecords
    Author

    The fault was on my side here: I thought I'd have to add springdoc-openapi-webflux-ui in case I want swagger ui support for my @GetMapping Flux/Mono endpoints.

    But that's not the case, so removing the dependency solved that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions