Or are there plans to support it?
There definite is a plan to support it. It will however have to wait till Open API support is completed.
Spring 5 was released. Do u have any progress?
@oleg-savko Unfortunately now. Would love some help on this one. Anyone wanting to help with that.
@dilipkrish - Would like to contribute to #1773,can you help me with getting started guide.
@amitsaluja frankly I haven't tried it andI don't know what it will take. I suspect certain functionality is not working or is broken.
Thank you for wanting to help!
Hi @dilipkrish
I looked into it and I found out that there is a lot of job to do.
In webflux, there is no more package web.servlet but it changed to web.reactive which requires more changes than expected. If you want to support the older versions of Spring after release, you probably need to create new modules for webflux where new things will be done.
At the moment, there is 2 modules in the project which are dependent on springframework.web.servlet and directly use a lot of classes from it. Spring 5 has moved staff from there to org.springframework.web.reactive where also some structure and implementation of classes was changed.
Maybe it will be good to figure out how new modules would be organized in the future so the project will be easily maitained. What do you suggest?
Hi @dilipkrish, I think the WebFlux support will be a very important milestone for springfox.
Follow with the finding from @xBATx , I would find there are 2 major update on springfox need your input.
For (1), currently, RequestHandler depends on class NameValueExpression, PatternsRequestCondition and RequestMappingInfo is in webmvc package. They have the counter part in webflux "org.springframework.web.reactive" (see the link). Shall we consider.
@MinosPong thanks for your detailed analysis. I would agree with your findings. I really don't have the bandwidth to work on this right now and could use some help.
swagger+netty server+webflux with kotlin is so cool.
@JackFish baby steps :)
Hello, I need this feature on my project.
I have rewrite some code of springfox to work exclusively with spring-webflux, this take 4 hours to do.
This work fine, there are two many dependency to broke :
Now, I will try to rewrite my code to work with springmvc and spring-webflux in parallel. My big issue is that springfox-core depend of spring-webmvc, I think broke this dependency can broke some dependent projects.
Has someone already start a fork of springfox to work on that?
I have a verry first working swagger lib on this fork : https://github.com/deblockt/springfox
Is there anyone to work with me on this?
Hi, I checked out your project and managed to adopt it in one of my projects, currently migrated to spring-boot-2.0.0.M7.
Few things I noticed right away though,
@deblockt that is really cool!! Would love to help and answer any questions you might have. Let me know if you'd like access to this repo work on it.
@deblockt nice work!
Your changes are working very well with webflux. I hope that it will be in a released version soon.
@deblockt Would you like to send a PR to pull your changes in.
Hi all,
I also need springfox that is compatible with Spring 5 and Spring Data Kay. I've managed to get it working and passing the tests at https://github.com/iles-2e/springfox.
Now I haven't tried to support the new features in the Spring 5 as @deblockt , this is just updating dependencies and fixing broken API changes. In order to build the whole thing, I also needed to update Spring Boot, so this one uses recently released spring-boot:2.0.0.RC2.
I've read somewhere you're trying to support java 1.6+? With Spring 5 and all, the minimum is 1.8 so perhaps this is a good way to start springfox 3.x? We could remove Guava then as well...
@iles-2e thank you! I could use all the help. At the moment trying to get 2.8.1 out with some bug fixes. And 2.9.0 will be the last release with support for 1.6 with some improvements in model generation => #2056 and hopefully get to pull in @deblockt 's PR as well. The plan is to move to 3.x :) ... and java 8 \o/
Hey. Is there any timeline for version 2.9.0 with @deblockt 's PR?
@deblockt i tried your code and /v2/api-docs endpoint is giving the swagger json. but /swagger-ui.html is not working, have we changed the swagger-ui endpoint?
@Naitik333 looks like extending WebFluxConfigurationSupport causes this problem. I just removed this and /swagger-ui.html works
@jarekCC i removed the extending of WebFluxConfigurationSupport, but still i am not getting /swagger-ui.html endpoint. even while server startup, i dont see any logs of mapping url for swagger-ui.html like "RequestMappingHandlerMapping : Mapped "{[/v2/api-docs],methods=[GET]" for /v2/api-docs
@dilipkrish Any timeline when these enhancement will be released?
After April
@Naitik333, for me having this in my classpath:
@Configuration
//@EnableWebFlux <-- this caused the problem
public class WebConfig implements WebFluxConfigurer {
}
caused http://localhost:8080/swagger-ui.html to show 404.
After removing the annotation, swagger works fine
@eximius313 Putting @EnableWebMvc and/or @EnableWebFlux will assume you're not going to auto configure the web application. That is why you're seeing a 404.
If you do want to enable web flux like you did, then you need to make sure that you configure the resource handlers for swagger ui.
Can't wait, this stops us from upgrading to Spring Boot 2.0. And also this problem https://github.com/springfox/springfox/issues/2298
@Hronom , temporarily you can use this fork. It has changes for SpringBoot 2.0, WebFlux and JDK9 in master. Just clone and do ./gradlew clean build -x test publishToMavenLocal
Hello, how about
NoSuchMethodError: org.springframework.data.repository.support.Repositories.getRepositoryInformationFor?
You are closing all bugs related to this particular problem.
Also very interested about fixing of exception:
NoSuchMethodError: org.springframework.data.repository.support.Repositories.getRepositoryInformationFor?
@exxbrain Not closing all bugs related to this, just closing duplicates :) spring 5 is going to be addressed for sure in the next release. I'll see what I can do to fix the NoSuchMethodError /c @Hronom
@deblockt Your branch works like a charm, the only issue is the model shows Mono< XXXModel > rather than XXXModel in requestBody and response.
In spring boot 2, the biggest feature is to write reactive code which will have all request body/response in Mono/Flux.
Is there any news about :
NoSuchMethodError: org.springframework.data.repository.support.Repositories.getRepositoryInformationFor?
I`ve tried using 2.9.0 and got the same error.
Java 8 must be supported before resolving the NoSuchMethodError: org.springframework.data.repository.support.Repositories.getRepositoryInformationFor.
The error come from the API in spring-data-rest 3 which has changed, the method getRepositoryInformationFor (and quite a few others) now returns Optionals.
I have made a crude patch here (based on the fork of @eximius313) : https://github.com/rastaman/springfox but i guess these changes should wait until Springfox compile only with java 1.8 and supports spring-data-rest 3, due to the optionals (and the patch should be cleaner).
F*ck it's wait months again... ?
Unfortunately yes, @Hronom. Open API support plus Spring 5 plus Spring Boot 2.0 plus Java 8/10 will take a little bit of time.
@dilipkrish Sorry for pushing, can you approximately estimate about how long it can take?
All of those are the easy part, there is a much requested #2056 by @MaksimOrlov I'd like to pull in. And I'm not sure how long it'll take to stabilize. My estimate is prolly end of May beginning June.
@dilipkrish But if I using Spring 5 WebFlux RouterFunction and HandleFunction with application/stream+json like this:
@Configuration
public class RoutingConfiguration {
@Bean
public RouterFunction<ServerResponse> userRoutes() {
return RouterFunctions.route(
RequestPredicates.GET("/users"),
request -> ServerResponse.ok().contentType(MediaType.APPLICATION_STREAM_JSON)
.body(/* load some flux, like: Flux.fromIterable(List.of(1, 2, 3)), new ParameterizedTypeReference<Integer>() {} */)
);
}
}
How possible to auto generate this response entities' document...I think it is impossible, so should I manually generated?
I believe swagger 2.0 doesnt support streaming APIs. So I dont think that it can be described, until we release 3.0, which doesnt really have very good support either :)
swagger2(2.8.0) : is it supporting spring web flux ?
Getting below error :
java.lang.NoClassDefFoundError: org/springframework/web/servlet/HandlerMapping
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3139)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2266)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641)
... 20 common frames omitted
@yogeshbalu unfortunately no.
@dilipkrish I can provide feedback based on snapshot versions using our app if you would be interested in such a help. Thanks a lot for your work!
Recap:
[edit]
We - users of current Spring version - have only 3 options:
1) Embrace the future of REST which is called: HATEOAS that you are already using as that what Spring Data REST 3.x is and forget all about Swagger/openAPI.
2) Downgrade your WHOLE Spring ecosystem to: Boot 1.x, Data 2.x and Core to 4.x.
3) Hope Swagger team rewriting the whole Swagger codebase in Java 1.8.
Swagger 3.0 do not solve this problem or even address it at all. It actually makes the problem MUCH worse. As the swagger team resources are committed to writing 3.0 [AFAIK] in same old Java 1.6 it makes it nearly impossible for them to start rewrite on the project since is under heavy and active new development.
Am I right Springfox?
P.S. Our solution was write the swagger file by hand. (team member that updates our swagger yaml file drink free that night :P)
@Turneliusz that would be very useful, please do!
@mikezerosix thanks for the detailed feedback! Will be real useful when we move forward with this issue
hi there, i'm using springboot 2.0.3 (with spring data rest 3.0.8 and spring security 5.0.6) and the springfox-data-rest is not working, i suppose it's becuase of this feature request
i've tried the https://github.com/rastaman/springfox @rastaman fork but it's not working (having problems with autowiring in webFluxRequestHandlerProvider for List
marcominetti, see my previous comment on Recap of this problem.
Answer is: NO workaround and no hope.
@mikezerosix So do you mean that support of java 1.8 not problem for springfox, the problem comes from Swagger project?
Please can you add link on the project or issue for swagger java?
Hronom,
Spring 5.x Java bytecode version >= 1.8
Swagger Java bytecode version = 1.6
Spring 5.x Java bytecode version == Swagger Java bytecode version
==>
1.6 >= 1.8
==>
FALSE
@mikezerosix I understand that, I'm was asking link to the project there springfox depends.
As far as I understand, springfox depends on swagger-core
They wrote that latest stable version is v2.0.2, here is the pom.xml for this version.
As you can see there:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
Seems like they ok with Java 1.8.
Right now springfox use v1.5.20, link.
So, according to this, springfox needs to be upgraded to swagger-core of version v2.0.2 em I right?
Also if you download from maven central this jar swagger-core-2.0.2.jar
It contains:
Manifest-Version: 1.0
Bnd-LastModified: 1527175384775
Build-Jdk: 1.8.0_144
Built-By: ron.ratovsky
Bundle-Description: Sonatype helps open source projects to set up Mave
n repositories on https://oss.sonatype.org/
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.html
Bundle-ManifestVersion: 2
Bundle-Name: swagger-core
Bundle-SymbolicName: io.swagger.core.v3.swagger-core
Bundle-Version: 2.0.2
Created-By: Apache Maven Bundle Plugin
And if you execute javap -v AnnotatedType | grep major on one of classes from this jar, it returns:
major version: 52
this means it compiled with java 1.8:
45.3 = Java 1.1
46 = Java 1.2
47 = Java 1.3
48 = Java 1.4
49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
swagger supports java 8 and builded with it.
It seems that for version 3, they changed GroupId, so in maven central they under io.swagger.core.v3
So need somehow upgrade springfox to use 2.0.2...
@Hronom That is exactly it. springfox is moving to java 8 and followed by support for spring 5 and boot 2
My working theory from little debugging and information some form springfox team itself- about this problem is:
It does not "depend on" in traditional sense. What I assume is springfox does it digs up information about the applications "REST" endpoints from it's class instances using Reflection. And it seemed that Springfox is Java 1.6 (from someone's comment, which I think was from springfox team. I did not verify myself, my bad. Well the problem still is method with Optional parameters which also pointed to Java 1.6) it does not seem to recornize methods with Optional
The first common point of failure is when sprinfox code tries to invoke via reflection:
Optional
Seems I was wrong about all springfox code being 1.6, but I think the Java version problem is in
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-data-rest</artifactId>
<version>2.9.0</version>
</dependency>
@mikezerosix fix for this is coming up... in the process of chipping away at java 8, spring boot 2 support
Great news, @mikezerosix. Could you please give a rough estimation when you'll publish the fix? Many thanks.
I'll try to get this out sooner than the open api 3.0 support
Thanks @dilipkrish! Is 3.0 still targeted for September?
Yes that is the plan
Spring Boot 2.0.3.RELEASE
SpringFox 2.9.2
documentationPluginsBootstrapper Bean creation error due to java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'documentationPluginsBootstrapper' defined in URL [jar:file:/Users/vgadda/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/plugins/DocumentationPluginsBootstrapper.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcRequestHandlerProvider' defined in URL [jar:file:/Users/vgadda/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:732)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1276)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1133)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at mdm.cuf.core.demo.petstore.hub.server.PetStoreServerApplication.main(PetStoreServerApplication.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcRequestHandlerProvider' defined in URL [jar:file:/Users/vgadda/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:732)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1276)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1133)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1325)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1291)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
... 22 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1708)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1325)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1291)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
... 39 common frames omitted
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.createAnnotationData(Class.java:3526)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotation(Class.java:3415)
at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258)
at java.lang.Class.isAnnotationPresent(Class.java:3425)
at org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:573)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:177)
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:217)
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:188)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:129)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1767)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1704)
... 53 common frames omitted
@karthikbingi666 - this is a terrible view to take. None of us are customers. We are all using work others are doing for free. You aren't paying them a dollar for their efforts. I'm sure they would welcome pull requests and help on this.
@karthikbingi666 Its fair comment that its taking long to support this. There are a number of reasons for it, the most important one being maintaining compatibility. Not everyone has the luxury to move to java 8 and spring 5 and spring boot 2.0. So it is more important to maintain backwards compatibility with older versions, since supporting this feature means moving to a completely new stack and that is not a decision we want to force on users. Secondly, there is not enough time in my day to maintain concurrent versions and have parallel work streams, so a move to java 8 means development of the older versions and patches have to stop. If you see the 2.9.x release, you'll realize how many issues have been fixed, prior to starting work on this feature. This is to ensure, folks on older versions have as few bugs/issues as possible before dropping support for older versions of spring/java.
there are customers who don't pay a single penny even though services will resolve there issues ASAP
This is not that kind of project unfortunately. It isn't supported by companies of the likes of Pivotal, Microsoft or Google, who have the time and resources to act like you expect.
from that point of view SpringFox is worst spring framework for documentation, sadly i can't find any alternatives also
Please feel free to improve it. PR's are welcome.
and these SpringFox guys delaying very long long time to fix this issue
🤷♂️
@jjathman thank you for chiming in to support 👍 🤘, much appreciated.
There have been quite a few folks who have helped out (thank you to them!), so the 3.0.0-SNAPSHOT build totally supports spring 5, spring boot 2.0. It is missing support for webflux, which I'm currently working on. I hope to have that in the next month.
@karthikbingi666 - two alternatives. You could use Spring REST Docs, which is obviously a 1st class supported feature of Spring. Alternatively, you could simply create the Swagger spec file yourself and use that. SpringFox is just doing the hard work of generating that for you, but once you did that once it wouldn't take much to maintain it in the future.
@karthikbingi666
Wow! Someone feels a bit entitled, don't you ?
So as a "customer", how much did you pay ?
Last Java software I bought did cost 7200€ it was HTML5+CSS Printing to PDF library from PDF Reactor. It worked great and they had best ever customer service I have ever seen.
Here in real world you are only entitled to what you pay for.
I am frustrated about this problem too. You do know Spring Data REST 3.x is HATEOAS which is the next generation of REST making whole Swagger/OpenAPI hack completely obsolete. And Spring has HAL browser that is similar to the swagger HTML page, you just need to import the HAL Browser dependency. https://docs.spring.io/spring-data/rest/docs/current/reference/html/#_the_hal_browser
Although the whole point of HATEOAS is that you do not need external documentation.
Unfortunately for us our customer is using IBM legacy crap and requires us to provide the Swagger 2 yaml. Which we now need to write by hand :(
P.S. @jjathman You are wrong, it DOES take a lot of work to maintain Swagger manually. It is a PITA to maintain and REALLY error prone. Specially when you have nested entities to which the Spring auto generates the URLs for.
Big thank you to @deblockt and @ligasgr! This has been merged, would appreciate any/all feedback for 3.0.0-SNAPSHOT!
@dilipkrish I just try to use sprinfox / spring-fox-swagger-ui 3.0.0-SNAPSHOT with Spring 5 + Spring WebFlux, and it works like a charm.
Thank you for your great work !
And thank you to all contributors of this feature !
@clebettre I couldn't get it to work with Webflux, can you give an example minimal working project with swagger2 and webflux?
@pgilad
Please make sure that as mentioned in #2608 you have to have
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
and
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webflux</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
@pgilad If you need an example, see this repository : https://github.com/clebettre/springfox-spring-webflux-example
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
@EnableSwagger2WebFlux on your SpringApplication.class (or on your configuration class)Hope this helps
Thanks that is awesome!
Hi guys,
The new 3.0.0 snapshot is working great, I have even tried it with older version of swagger-ui - 2.7.0 and its perfect.
One thing I notice though, in Swagger2ControllerWebFlux there is
private static final String DEFAULT_URL = "/v2/api-docs";
And on the getDocumentation() method:
@RequestMapping(
value = DEFAULT_URL,
method = RequestMethod.GET,
produces = { APPLICATION_JSON_VALUE, HAL_MEDIA_TYPE })
which gives us no way of overwriting the documentation path with springfox.documentation.swagger.v2.path in application.properties.
I was trying to use 3.0.0-SNAPSHOT, but I get java.lang.ClassCastException: springfox.documentation.builders.PathSelectors$1 cannot be cast to com.google.common.base.Predicate
Previously this worked like that:
@Bean
public Docket api(final TypeResolver typeResolver) {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("BitBay Pay")
.apiInfo(apiInfo())
.select()
.paths(Predicates.not((Predicate<String>)PathSelectors.regex("/actuator.*"))) <-- here
.build()
.genericModelSubstitutes(Mono.class)
.alternateTypeRules(
AlternateTypeRules.newRule(
typeResolver.resolve(Flux.class, WildcardType.class),
typeResolver.resolve(Collection.class, WildcardType.class)))
.useDefaultResponseMessages(false);
}
How do I define regexp predicate now?
Hi! thank you so much for supporting webflux!
I am trying to auto generate reactive/reactor classes using springfox.
I added the required dependencies and the @EnableSwagger2WebFlux to my empty Configuration class. how and where can I define if the auto gen controller will be a Mono or Flux for example? because right now its neither of them.
Springfox works in the opposite direction : it generates OAI specs from your Webflux endpoints. To generate code from an OAI spec, use something like OpenAPI-generator
which gives us no way of overwriting the documentation path with springfox.documentation.swagger.v2.path in application.properties.
@goodlifeinc thats great feedback, as you notice the 3.0.0-SNAPSHOT is still a little rough.
I was trying to use 3.0.0-SNAPSHOT, but I get java.lang.ClassCastException: springfox.documentation.builders.PathSelectors$1 cannot be cast to com.google.common.base.Predicate
@eximius313 Try switching to using standard java predicates. We removed the guava dependency from the library.
@IsaacDeLaRosa would appreciate taking the discussion of open api generator to the respective repository.
With latest Spring boot & data REST I am getting:
No qualifying bean of type 'com.fasterxml.classmate.TypeResolver' available
springfox-data-rest-3.0.0-20180818.144717-9.jar!/springfox/documentation/spring/data/rest/EntityServicesProvider.class]: Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.fasterxml.classmate.TypeResolver' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
This might be jackson (databind) version conflict in Spring boot and swagger ?
Sorry if I update this tthinked but probably is related to this topic. I'm using the last snapshot and I've and endpoint like this:
@GetMapping(path = "/loggedAgent")
public ResponseEntity<?> loggedAgent(Locale locale, PersistentEntityResourceAssembler resourceAssembler) {
CustomUserDetail loggedUser = SecurityUtils.getLoggedUser();
Agent loggedAgent = agentRepository.findByUsername(loggedUser.getUsername());
if (loggedAgent != null)
return new ResponseEntity<>(resourceAssembler.toResource(loggedAgent), HttpStatus.OK);
throw new ResourceNotFoundException(ExceptionCode.RESOURCE_NOT_FOUND, "");
}
In my application I'm using Spring (Spring MVC, Spring Data REST); localeand resourceAssembler are two parameters injected by Spring and they should not be displayed in Swagger.
Instead I see this.

If the method has some real addition parameter, then localeand resourceAssembler are not displayed anymore.
Is that a desidered behaviour?
Thanks
We also observed that version 3.0.0-SNAPSHOT caused some arguments (that were previously hidden) to appear (e.g. ServerWebExchange, AuthenticationPrincipal).
We solved this by adding .ignoredParameterTypes(AuthenticationPrincipal.class, ServerWebExchange.class) to our Docket
@eximius313 Thanks. Useful hint. @dilipkrish can you confirm this is a desired behaviour and we have to hide them programatically? Thanks
@dilipkrish can you confirm this is a desired behaviour and we have to hide them programatically?
This is good feedback. It is not the expected, this is obviously the result of not accounting for spring 5.0 types. Would you be kind enough to create an issue for that so that it can be tracked.
@dilipkrish Created https://github.com/springfox/springfox/issues/2642
Thanks
I am trying to use the github example project from clebettre (https://github.com/clebettre/springfox-spring-webflux-example)
and i am getting Caused by: java.io.FileNotFoundException: class path resource [springfox/documentation/spring/web/SpringfoxWebFluxConfiguration.class] cannot be opened because it does not exist
Any idea what the issue is?
I figured it out. I had to create
@Configuration
public class WebFluxConfig implements WebFluxConfigurer {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//swagger resource
//registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
registry.addResourceHandler("/swagger/**").addResourceLocations("classpath:/static/swagger/");
}
}
After that i could see all endpoints except the swagger-ui.html(got 404 error). I wrestled with this problem for a long time. Finally by trial and error, I commented out the swagger-ui.html mapping and it workled
I put together a basic starter demo repo (Gradle+Java) that has a minimal working example of Webflux + Swagger2. Currently I used @mpanicker work-around to get swagger-ui.html path to work (otherwise I get 404s).
https://github.com/pgilad/spring-boot-webflux-swagger-starter
For those who don't know, to import snapshots Springfox has provided steps.
<repositories>
<repository>
<id>jcenter-snapshots</id>
<name>jcenter</name>
<url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url>
</repository>
</repositories>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webflux</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
Just for clarification, as @mirromutth has pointed out initially, it seems that Spring Fox WebFlux support in its current form, does not work with the new WebFlux RouterFunction<ServerResponse> API. By that I mean _WebFlux in controller-less setup_ without any MVC annotations whatsoever.
This was brought up by @ianhitlgang in #2416 also.
Are there any plans to provide some semi automated solution for this or maybe some workaround along the lines of an older discussion in #1216?
EDIT:
As a workaround for _controller-less WebFlux applications_, you can write ApiListingScannerPlugin implementation and register types and endpoints manually. Good discussion on how to register and reference model types is in #1509.
Is there a timeframe for a 3.0.0 release?
this feature is in hot need, guys :)
Is there any way we can help in getting this released a bit sooner?
Before we rush to the release - there is a possible flaw in the Spring annotation based autoconfiguration.
I am currently working on a springfox plugin for spring-integration. In spring-integration you can have webflux or webmvc, but you have different providers for HandlerMappings:
WebFluxIntegrationRequestMappingHandlerMapping and IntegrationRequestMappingHandlerMapping. Currently, the swagger2 jar contains configuration files which automatically enables either a webflux or a webmvc controller. Webflux is enabled if the reactive BindingProvider is present, whereas Webmvc is enabled for a conceptually different reason.
My impression is, the webmvc variant is triggered by the presence of the springfox-spring-webmvc jar, but that jar also sets up the WebMvcRequestHandlerProvider, which should not be enabled, or at least not be enabled as the only RequestHandlerProvider, if spring-integration is supposed to work.
I am still in the process of sorting this out, but please let us make sure we get this right and do not create a situation where we need a breaking change for existing webflux or webmvc setups later.
@dschulten that has been my hunch as well, haven’t had any evidence yet. Thanks for pointing that out. Will look forward to your feedback. Thank you!
AFAIK you can't mix webflux and spring-mvc in the same app.
@dilipkrish I have opened https://github.com/springfox/springfox/issues/2754 to discuss the mechanics of the spring-integration plugin. The question how webflux or webmvc are chosen seems not to be a blocking issue ATM. Will push my fork soon.
@dschulten Thank you for working on this. Big fan of your work with affordances support in spring-hateoas. Looking forward to your fork
Any updates about timeline for 3.0.0 release?
Spring boot 2.1 webflux using @pgilad 's demo works.
I am using WebFluxConfigurationSupport not WebFluxConfigurer.
@Configuration
public class WebFluxConfigurationSupportConfigurer extends WebFluxConfigurationSupport {
@Override
protected void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
configurer.addCustomResolver(new ReactiveSortHandlerMethodArgumentResolver(),
new ReactivePageableHandlerMethodArgumentResolver());
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
// not work /swagger-ui.html return 404
// registry.addResourceHandler("/swagger-ui.html")
// .addResourceLocations("classpath:/META-INF/resources/");
//
// registry.addResourceHandler("/webjars/**")
// .addResourceLocations("classpath:/META-INF/resources/webjars/");
// not work /swagger-ui.html return 404
// registry.addResourceHandler("/webjars/**")
// .addResourceLocations("classpath:/META-INF/resources/webjars/");
//
// registry.addResourceHandler("/swagger/**")
// .addResourceLocations("classpath:/static/swagger/");
//works
registry.addResourceHandler("/swagger-ui.html**")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
We have found out that a Spring Boot 2.1 project, packaged as war and deployed on Tomcat 9, makes Springfox fail.
I have uploaded a very simple project to reproduce this issue: https://github.com/codependent/demo-webflux-springfox
The swagger-ui.html page loads successfully but, when it calls http://localhost:8080/demo2_webflux_war/v2/api-docs there is a 500 error with the following stacktrace:
2018-11-27 15:32:19.727 ERROR 8560 --- [nio-8080-exec-6] o.s.b.w.servlet.support.ErrorPageFilter : Forwarding to error page from request [/v2/api-docs] due to exception [No primary or default constructor found for interface org.springframework.http.server.reactive.ServerHttpRequest]
java.lang.IllegalStateException: No primary or default constructor found for interface org.springframework.http.server.reactive.ServerHttpRequest
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:219) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:84) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:139) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:165) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[servlet-api.jar:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.13]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [catalina.jar:9.0.13]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.13]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [catalina.jar:9.0.13]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:9.0.13]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-coyote.jar:9.0.13]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:9.0.13]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791) [tomcat-coyote.jar:9.0.13]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) [tomcat-coyote.jar:9.0.13]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.13]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_161]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.13]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161]
Caused by: java.lang.NoSuchMethodException: org.springframework.http.server.reactive.ServerHttpRequest.<init>()
at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_161]
at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[na:1.8.0_161]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:216) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 61 common frames omitted
2018-11-27 15:33:02.460 ERROR 8560 --- [nio-8080-exec-3] o.s.b.w.servlet.support.ErrorPageFilter : Forwarding to error page from request [/v2/api-docs] due to exception [No primary or default constructor found for interface org.springframework.http.server.reactive.ServerHttpRequest]
java.lang.IllegalStateException: No primary or default constructor found for interface org.springframework.http.server.reactive.ServerHttpRequest
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:219) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:84) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:139) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:165) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[servlet-api.jar:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.13]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.13]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [catalina.jar:9.0.13]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.13]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668) [catalina.jar:9.0.13]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [catalina.jar:9.0.13]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:9.0.13]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-coyote.jar:9.0.13]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:9.0.13]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791) [tomcat-coyote.jar:9.0.13]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) [tomcat-coyote.jar:9.0.13]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.13]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_161]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.13]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161]
Caused by: java.lang.NoSuchMethodException: org.springframework.http.server.reactive.ServerHttpRequest.<init>()
at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_161]
at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[na:1.8.0_161]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:216) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 61 common frames omitted
@codependent thanks for the example.
@kimec We have added RequestPredicate visitor in Spring Framework 5.1.3 (see SPR-17322), which opens the door to RouterFunction support in SpringFox. The idea is to implement a visitor that implements both RouterFunctions.Visitor and RequestPredicates.Visitor like in this example and this test.
@dilipkrish Should I open a dedicated issue for RouterFunction support, or do you prefer to reopen this one?
@sdeleuze looks nice. Not directly related, but if I can recall correctly, we still had issues extracting type of path variables from the URI because you are supposed to extract those manually from ServerRequest.
Of course one could treat all path variables as strings, but speaking API wise, you may want to let your customers know the variable is actually of long or int type (or even UUID).
We also found, that Spring Fox would generate no model data (when registered manually via additionalModels) if no @RestController was in application context. We had no time to investigate, so we just crated one dummy @RestController returning an arbitrary value. Spring Fox would then report manually registered addionalModels as well. Maybe this is not a problem anymore.
Hey, I'm getting
ERROR [:] ContextLoader:312 - Context initialization failed java.lang.NoClassDefFoundError: org/springframework/core/ErrorCoded
with springfox 3.0.0 snapshot and 2.9.2. I have spring 5.1.2. Is there anything I can do to fix it or do I have to wait for future release?
@dilipkrish I was using swagger-ui for documenting the API but when I updated my project to spring 5 to work with webflux, swagger-ui is not working. There is 3.0.0 snapshot version available which I found from the previous comments, it work well for me. But when would be new release version coming which will support the Spring 5 version.
@dilipkrish I upgraded to Spring 5/Webflux and using the comments above was able to get swagger-ui to work. Just one note: I had to remove springfox.documentation.swagger.v2.path=/swagger2/api-docs from my application.properties -- otherwise I got a 404 for /swagger2/api-docs
I made it work with @EnableSwagger2WebFlux
But it doesn't show any operations.
When I define
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.any())
.build().apiInfo(apiEndPointsInfo());
the read-operation-handler and web-flux-links-handler are shown at least.
I am not using @Path annotations but
public RouterFunction
which defines routes like
.andRoute(GET("/any-route"),anyRouterHandler::test)
I added @ApiOperation to this anyRouterHandler.test function.
I tried @Api anotions at this handler or the RoutingConfiguration but all to no avail.
What am I missing?
And i have kotlin models and repositories. But I didn't expect those to show up anyways :)
could you post a sample project mheidt ?
2 years after... still waiting...
Hello. Do you have an idea/plan when the 3.0.0 will be released on Maven Central?
It works with the following entries in the pom.xml and single configuration file for webflux.
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webflux</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<repositories>
<repository>
<id>spring-libs-milestone</id>
<name>Spring Milestone Maven Repository</name>
<url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url>
</repository>
</repositories>
@Configuration
@EnableSwagger2WebFlux
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
But not sure when springfox 3.0.0 is going to be available in maven central
@remesh22 te config works, but no maps the class Mono or Flux

For those who need Spring Framework 5 + OpenAPI support, be aware there is now also a community driven support for OpenAPI built on top of Spring Rest docs, see https://github.com/ePages-de/restdocs-api-spec.
At the same time, I hope SpringFox 3.0 with Spring Framework 5 support will be out soon.
https://github.com/springfox/springfox/issues/1773#issuecomment-416182142
@mikezerosix: I am using spring boot 2 and springfox 3 snapshot
Even I am getting 'com.fasterxml.classmate.TypeResolver' error. "Field typeResolver in ...SwaggerConfiguration required a bean of type 'com.fasterxml.classmate.TypeResolver' that could not be found"
Were you able to resolve this? Anyone else has solution for this?
@J-Ibarra same question with you now . have you already fixed it?
Do you have an idea/plan when the 3.0.0 will be released on Maven Central?
@bestshiyuhua, no!
@J-Ibarra @bestshiyuhua not sure if this is the same problem, but I have the content model now showing, not the Mono/Flux {} problem, by configuring genericModelSubstitutes, like so
@Bean
internal fun api(): Docket =
Docket(SWAGGER_2)
.genericModelSubstitutes(Mono::class.java, Flux::class.java, Publisher::class.java)
.select()
...
.build()
Hoping this gets released officially soon
@maccamlc awesome, thank very much, this works for me


@bestshiyuhua
Can you share your project?
@pehkay sure, https://github.com/J-Ibarra/swagger-webflux-demo
tried with 3.0.0-SNAPSHOT, got this when accessing /api-docs:
ERROR --- [dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: No primary or default constructor found for interface org.springframework.http.server.reactive.ServerHttpRequest] with root cause
java.lang.NoSuchMethodException: org.springframework.http.server.reactive.ServerHttpRequest.<init>()
at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_192]
at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[?:1.8.0_192]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:216) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:84) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:139) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:126) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:167) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88) ~[spring-boot-actuator-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114) ~[spring-boot-actuator-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104) ~[spring-boot-actuator-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at io.opentracing.contrib.web.servlet.filter.TracingFilter.doFilter(TracingFilter.java:189) ~[opentracing-web-servlet-filter-0.3.0.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) [tomcat-embed-core-9.0.21.jar:9.0.21]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.21.jar:9.0.21]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_192]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_192]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.21.jar:9.0.21]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192]
genericModelSubstitutes works but for Flux doesn't show it's an array though
@Sam-Kruglov I recall that I just set the containerResponse to List and all works ....
I discovered this, plus genericModelSubstitutes by inspecting the annotation options. I'm new to spring fox but seems all the building blocks exist
I made it work with @EnableSwagger2WebFlux
But it doesn't show any operations.
When I definereturn new Docket(DocumentationType.SWAGGER_2).select() .apis(RequestHandlerSelectors.any()) .build().apiInfo(apiEndPointsInfo());the read-operation-handler and web-flux-links-handler are shown at least.
I am not using @path annotations but
public RouterFunction monoRouterFunctionwhich defines routes like
.andRoute(GET("/any-route"),anyRouterHandler::test)I added @ApiOperation to this anyRouterHandler.test function.
I tried @Api anotions at this handler or the RoutingConfiguration but all to no avail.What am I missing?
And i have kotlin models and repositories. But I didn't expect those to show up anyways :)
Did you ever find a solution for this issue?
Did you ever find a solution for this issue?
No. I switched technology. Using RabbitMQ and a JHipster frontend instead of Swagger2WebFlux
The SpringFox 3 (Snapshot version) Swagger UI documentation is not generating properly the File Input Button for FilePart.
But working fine in Spring Doc Swagger UI.

@PostMapping(value = "/upload", consumes = {"multipart/form-data"})
public void uploadDocument(@Valid @RequestPart(value = "uploadedBy") String uploadedBy,
@Valid @RequestPart(value = "file",required = false) FilePart file) throws Exception
{
......
}
Any help is appreciated.
@Sam-Kruglov Did you manage, to solve the issue with ServerHttpRequest.
@matus-krska if I remember correctly I tried this approach but actually I am still using 2.7.
Are there any updates? In our project we need the springfox integration for webflux, but the Snapshot is in development for over three year. Are there any plans on when this feature will be released? Or is there a good workarround for using the 2.9.2 release with webflux?
@Numbernick we had an ugly so-so solution working for 3.0 SNAPSHOT, but one day 3.0-SNAPSHOT started to track a newer release of Spring which completely broken all our builds so we dropped the idea using spring-fox with WebFlux altogether (yes, it is a bad practice to follow SNAPSHOT builds in your production builds but there was no other choice at that time).
At one point I tried to port our code to spring-fox but I simply could not wrap my head around the custom gradle build infrastructure of spring-fox which seem to have quite some history.
So in the end we reverted to 2.9.2 and created a static swagger.yaml. Now whenever we add new WebFlux endpoints, we just write the API definition manually. We are using 2.9.2 effectively as a webjar to provide swagger-ui only. We could probably use some other webjar with swagger-ui, but using spring-fox swagger-ui was the fastest hack to make our builds work again.
@Numbernick, @kimec release of 3.0.0 is planned on this month. OAS 3.0 is almost ready. We are porting other features for a new api.
@MaksimOrlov Thank you very much for this information. I am looking forward to it :)
@kimec Thank you for the idea of this workarround. It is an interessting way (fortunately our service hasn't seen the light of production yet)
@codemasterbish A workarround to make uploads work in the Swagger-UI is to set the FilePart to a MultipartFile
Docket(SWAGGER_2)
[...]
.alternateTypeRules(RecursiveAlternateTypeRule(
typeResolver,
listOf(
newRule(
typeResolver.resolve(FilePart::class.java),
typeResolver.resolve(MultipartFile::class.java))
))
)
I'm trying to use Springfox3 (Snapshot version) for my SpringWebflux project, I have used @EnableSwagger2WebFlux, but it is not showing any operations.
I'm using RouteFunction to define routes, sample class is given below (kotlin)
@Configuration
class EmployeeRoute(val employeeHandler: EmployeeHandler) {
@Bean
fun linkRouter(employeeHandler: EmployeeHandler): RouterFunction
return router {
GET("/v1").nest {
GET(
"/employees",
employeeHandler::handleGetEmployees
)
GET(
"/employees/{employeeId}",
employeeHandler::handleGetEmployeeById
)
}
}
}
}
And I added @ApiOperation in the EmployeeHandler class methods (handleGetEmployees & handleGetEmployeeById)
Will Springfox3 ((Snapshot version) ) be able to identify the paths/operations if we define the Route functions as above and @ApiOperation in handler class?
Most helpful comment
There definite is a plan to support it. It will however have to wait till Open API support is completed.