title: springdoc-openapi + Spring 4 Compatibility
body: <p>I have an existing Spring 4 API and have successfully integrated springdoc-openapi to generate the OpenAPI 3 spec in JSON/YAML and also display the Swagger UI using springdoc-openapi 1.2.29 and Spring Boot 15.2.2.RELEASE, however there appear to be various bugs that were fixed and enhancements added in later versions of springdoc-openapi.  Unfortunately I am running into various compatibility issues with Spring 4 if I use versions higher than springdoc-openapi 1.2.29.</p>
  
  <p>Is there an availability compatibility matrix for springdoc-openapi and Spring 4?  As I read through the springdoc-openapi documentation, I do not see any readme or release notes suggesting there is a Spring 5 requirement, however as noted below there are Spring 5 classes used in the underlying springdoc-openapi once you reach a certain version.</p>
  
  <p>My relevant POM:</p>
  
  <pre><code>    &lt;!-- springdoc-openapi-ui --&gt;
      &lt;!-- anything over 1.2.33 uses Spring 5 MethodParameter.getParameter()--&gt;
      &lt;!-- anything over 1.2.29 uses Spring 5 org.springframework.http.codec.multipart.FilePart --&gt;
      &lt;!-- webjars-locator-jboss-vfs is required for running under JBOSS and exposing the swagger-ui --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springdoc&lt;/groupId&gt;
          &lt;artifactId&gt;springdoc-openapi-ui&lt;/artifactId&gt;
          &lt;version&gt;1.2.29&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!--  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springdoc&lt;/groupId&gt;
          &lt;artifactId&gt;springdoc-openapi-security&lt;/artifactId&gt;
          &lt;version&gt;1.2.29&lt;/version&gt;
      &lt;/dependency&gt;
      --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot&lt;/artifactId&gt;
          &lt;version&gt;1.5.22.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-autoconfigure&lt;/artifactId&gt;
          &lt;version&gt;1.5.22.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.webjars&lt;/groupId&gt;
          &lt;artifactId&gt;webjars-locator-jboss-vfs&lt;/artifactId&gt;
          &lt;version&gt;0.1.0&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>When using springdoc-openapi-ui 1.2.30, it will subsequently bring in springdoc-openapi-common-1.2.30.jar which throw an exception trying to use org.springframework.http.codec.multipart.FilePart.  Likewise, using 1.2.34 or higher will throw an exception on MethodParameter.getParameter().</p>
  
  <pre><code>12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1) Caused by: java.lang.NoClassDefFoundError: org/springframework/http/codec/multipart/FilePart
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.core.GenericParameterBuilder.isFile(GenericParameterBuilder.java:271)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.core.GenericParameterBuilder.isFile(GenericParameterBuilder.java:296)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.core.AbstractRequestBuilder.buildParams(AbstractRequestBuilder.java:271)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.core.AbstractRequestBuilder.build(AbstractRequestBuilder.java:174)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.api.AbstractOpenApiResource.calculatePath(AbstractOpenApiResource.java:205)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.api.OpenApiResource.calculatePath(OpenApiResource.java:134)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.api.OpenApiResource.getPaths(OpenApiResource.java:99)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.api.AbstractOpenApiResource.getOpenApi(AbstractOpenApiResource.java:124)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springdoc.api.OpenApiResource.openapiJson(OpenApiResource.java:83)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  12:15:05,003 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at java.lang.reflect.Method.invoke(Method.java:498)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
  12:15:05,004 ERROR [stderr] (ajp-localhost/127.0.0.1:8009-1)    ... 61 more
  </code></pre>
  
  <p>Spring 5 reference:  <a href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/codec/multipart/FilePart.html" rel="nofollow noreferrer">https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/codec/multipart/FilePart.html</a></p>
  
  <pre><code>public interface FilePart
  extends Part
  
  Specialization of Part that represents an uploaded file received in a multipart request.
  
  Since:
      5.0
  </code></pre>
  
  <p>Any suggestions on how to work around this to leverage the bug fixes and enhancements in springdoc-openapi in later versions?</p>