springfox / springfox

Automated JSON API documentation for API's built with Spring
http://springfox.io
Apache License 2.0
5.93k stars 1.54k forks source link

generate-executable failed: Ambiguous mapping #3664

Closed josephabijaoude closed 3 years ago

josephabijaoude commented 3 years ago

Hello, It seems that two method are mapped to the same endpoint. While compiling my project, I'm getting the following error:

Execution generate-executable of goal com.murex.serviceframework.tools:java-rest-runtime-maven-plugin:1.3.9:generate-executable failed: Ambiguous mapping. Cannot map 'springfox.documentation.oas.web.OpenApiControllerWebFlux' method public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.oas.web.OpenApiControllerWebFlux.getDocumentation(java.lang.String,org.springframework.http.servr.reactive.ServerHttpRequest) to {GET /v3/api-docs, produces [application/json || application/hal+json]}: There is already 'springfox.documentation.oas.web.OpenApiControllerWebMvc' bean method public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.oas.web.OpenApiControllerWebMvc.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest) mapped.

The project is spring boot and I've added the following dependency: `

io.springfox
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>

`

And on my configuration: @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); }

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

VincentTran1994 commented 2 years ago

I am facing the same issue. Any solution in this case?

Vergilon commented 2 years ago

@VincentTran1994 use comand mvn dependency:tree and find out which dependency (most likely webflux) is using springfox. After that remove this dependency, or use maven exclusion to exclude springfox from it.

jfkubraozdemir commented 1 year ago

@VincentTran1994 use comand mvn dependency:tree and find out which dependency (most likely webflux) is using springfox. After that remove this dependency, or use maven exclusion to exclude springfox from it.

How?