You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h3id="_how_to_integrate_open_api_3_with_spring_project_not_spring_boot"><aclass="anchor" href="#_how_to_integrate_open_api_3_with_spring_project_not_spring_boot"></a>How to Integrate Open API 3 with Spring project (not Spring Boot)?</h3>
1848
+
<divclass="paragraph">
1849
+
<p>When your application is using spring without (spring-boot), you need to add beans and auto-configuration that are natively provided in spring-boot.</p>
1850
+
</div>
1851
+
<divclass="paragraph">
1852
+
<p>For example, lets assume you want load the swagger-ui in spring-mvc application:</p>
1853
+
</div>
1854
+
<divclass="ulist">
1855
+
<ul>
1856
+
<li>
1857
+
<p>You mainly, need to add the springdoc-openapi module</p>
<p>If you don’t have the spring-boot and spring-boot-autoconfigure dependencies, you need to add them. And pay attention to the compatibility matrix, between you spring.version and spring-boot.version. For example, in this case (spring.version=5.1.12.RELEASE):</p>
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
1914
+
context.register(this.getClass(),
1915
+
SpringDocConfiguration.class,
1916
+
SpringDocConfigProperties.class,
1917
+
SpringDocSpecPropertiesConfiguration.class,
1918
+
SpringDocWebMvcConfiguration.class,
1919
+
MultipleOpenApiSupportConfiguration.class,
1920
+
SwaggerConfig.class,
1921
+
SwaggerUiConfigProperties.class,
1922
+
SwaggerUiOAuthProperties.class,
1923
+
SpringDocUIConfiguration.class
1924
+
);
1925
+
return context;
1926
+
}
1927
+
}
1928
+
</code></pre>
1929
+
</div>
1930
+
</div>
1931
+
<divclass="ulist">
1932
+
<ul>
1933
+
<li>
1934
+
<p>Depending on your module, you can find them on the file: <code>org.springframework.boot.autoconfigure.AutoConfiguration.imports</code> of each <code>springdoc-openapi</code> module.</p>
1935
+
</li>
1936
+
<li>
1937
+
<p>For groups usage make sure your <code>GroupedOpenApi</code> Beans are scanned.</p>
1938
+
</li>
1939
+
<li>
1940
+
<p>If additionally, you are using custom <code>context path</code>: <code>/my-servlet-path</code>. Make sure you declare the following property:</p>
<h3id="_what_is_the_compatibility_matrix_of_springdoc_openapi_with_spring_boot"><aclass="anchor" href="#_what_is_the_compatibility_matrix_of_springdoc_openapi_with_spring_boot"></a>What is the compatibility matrix of <code>springdoc-openapi</code> with <code>spring-boot</code> ?</h3>
1848
1952
<divclass="paragraph">
1849
1953
<p><code>springdoc-openapi 2.x</code> is compatible with <code>spring-boot 3</code>.</p>
<li><ahref="#how-can-i-define-different-description-for-a-class-attribute-depending-on-usage">13.75. How can i define different description for a class attribute depending on usage?</a></li>
<li><ahref="#is-graalvm-supported">13.77. Is GraalVM supported ?</a></li>
226
-
<li><ahref="#what-is-the-compatibility-matrix-of-springdoc-openapi-with-spring-boot">13.78. What is the compatibility matrix of <code>springdoc-openapi</code> with <code>spring-boot</code> ?</a></li>
227
-
<li><ahref="#why-am-i-getting-an-error-swagger-ui-unable-to-render-definition-when-overriding-the-default-spring-registered-httpmessageconverter">13.79. Why am i getting an error: <code>Swagger UI unable to render definition</code>, when overriding the default spring registered <code>HttpMessageConverter</code>?</a></li>
228
-
<li><ahref="#some-parameters-are-not-generated-in-the-resulting-openapi-spec">13.80. Some parameters are not generated in the resulting OpenAPI spec.</a></li>
226
+
<li><ahref="#how-to-integrate-open-api-3-with-spring-project-not-spring-boot">13.78. How to Integrate Open API 3 with Spring project (not Spring Boot)?</a></li>
227
+
<li><ahref="#what-is-the-compatibility-matrix-of-springdoc-openapi-with-spring-boot">13.79. What is the compatibility matrix of <code>springdoc-openapi</code> with <code>spring-boot</code> ?</a></li>
228
+
<li><ahref="#why-am-i-getting-an-error-swagger-ui-unable-to-render-definition-when-overriding-the-default-spring-registered-httpmessageconverter">13.80. Why am i getting an error: <code>Swagger UI unable to render definition</code>, when overriding the default spring registered <code>HttpMessageConverter</code>?</a></li>
229
+
<li><ahref="#some-parameters-are-not-generated-in-the-resulting-openapi-spec">13.81. Some parameters are not generated in the resulting OpenAPI spec.</a></li>
<h3id="what-is-the-compatibility-matrix-of-springdoc-openapi-with-spring-boot"><aclass="anchor" href="#what-is-the-compatibility-matrix-of-springdoc-openapi-with-spring-boot"></a>13.78. What is the compatibility matrix of <code>springdoc-openapi</code> with <code>spring-boot</code> ?</h3>
4509
+
<h3id="how-to-integrate-open-api-3-with-spring-project-not-spring-boot"><aclass="anchor" href="#how-to-integrate-open-api-3-with-spring-project-not-spring-boot"></a>13.78. How to Integrate Open API 3 with Spring project (not Spring Boot)?</h3>
4510
+
<divclass="paragraph">
4511
+
<p>When your application is using spring without (spring-boot), you need to add beans and auto-configuration that are natively provided in spring-boot.</p>
4512
+
</div>
4513
+
<divclass="paragraph">
4514
+
<p>For example, lets assume you want load the swagger-ui in spring-mvc application:</p>
4515
+
</div>
4516
+
<divclass="ulist">
4517
+
<ul>
4518
+
<li>
4519
+
<p>You mainly, need to add the springdoc-openapi module</p>
<p>If you don’t have the spring-boot and spring-boot-autoconfigure dependencies, you need to add them. And pay attention to the compatibility matrix, between you spring.version and spring-boot.version. For example, in this case (spring.version=5.1.12.RELEASE):</p>
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
4576
+
context.register(this.getClass(),
4577
+
SpringDocConfiguration.class,
4578
+
SpringDocConfigProperties.class,
4579
+
SpringDocSpecPropertiesConfiguration.class,
4580
+
SpringDocWebMvcConfiguration.class,
4581
+
MultipleOpenApiSupportConfiguration.class,
4582
+
SwaggerConfig.class,
4583
+
SwaggerUiConfigProperties.class,
4584
+
SwaggerUiOAuthProperties.class,
4585
+
SpringDocUIConfiguration.class
4586
+
);
4587
+
return context;
4588
+
}
4589
+
}
4590
+
</code></pre>
4591
+
</div>
4592
+
</div>
4593
+
<divclass="ulist">
4594
+
<ul>
4595
+
<li>
4596
+
<p>Depending on your module, you can find them on the file: <code>org.springframework.boot.autoconfigure.AutoConfiguration.imports</code> of each <code>springdoc-openapi</code> module.</p>
4597
+
</li>
4598
+
<li>
4599
+
<p>For groups usage make sure your <code>GroupedOpenApi</code> Beans are scanned.</p>
4600
+
</li>
4601
+
<li>
4602
+
<p>If additionally, you are using custom <code>context path</code>: <code>/my-servlet-path</code>. Make sure you declare the following property:</p>
<h3id="what-is-the-compatibility-matrix-of-springdoc-openapi-with-spring-boot"><aclass="anchor" href="#what-is-the-compatibility-matrix-of-springdoc-openapi-with-spring-boot"></a>13.79. What is the compatibility matrix of <code>springdoc-openapi</code> with <code>spring-boot</code> ?</h3>
4509
4614
<divclass="paragraph">
4510
4615
<p><code>springdoc-openapi 2.x</code> is compatible with <code>spring-boot 3</code>.</p>
<h3id="why-am-i-getting-an-error-swagger-ui-unable-to-render-definition-when-overriding-the-default-spring-registered-httpmessageconverter"><aclass="anchor" href="#why-am-i-getting-an-error-swagger-ui-unable-to-render-definition-when-overriding-the-default-spring-registered-httpmessageconverter"></a>13.79. Why am i getting an error: <code>Swagger UI unable to render definition</code>, when overriding the default spring registered <code>HttpMessageConverter</code>?</h3>
4671
+
<h3id="why-am-i-getting-an-error-swagger-ui-unable-to-render-definition-when-overriding-the-default-spring-registered-httpmessageconverter"><aclass="anchor" href="#why-am-i-getting-an-error-swagger-ui-unable-to-render-definition-when-overriding-the-default-spring-registered-httpmessageconverter"></a>13.80. Why am i getting an error: <code>Swagger UI unable to render definition</code>, when overriding the default spring registered <code>HttpMessageConverter</code>?</h3>
4567
4672
<divclass="paragraph">
4568
4673
<p>When overriding the default spring-boot registered <code>HttpMessageConverter</code>, you should have <code>ByteArrayHttpMessageConverter</code> registered as well to have proper <code>springdoc-openapi</code> support.</p>
<h3id="some-parameters-are-not-generated-in-the-resulting-openapi-spec"><aclass="anchor" href="#some-parameters-are-not-generated-in-the-resulting-openapi-spec"></a>13.80. Some parameters are not generated in the resulting OpenAPI spec.</h3>
4696
+
<h3id="some-parameters-are-not-generated-in-the-resulting-openapi-spec"><aclass="anchor" href="#some-parameters-are-not-generated-in-the-resulting-openapi-spec"></a>13.81. Some parameters are not generated in the resulting OpenAPI spec.</h3>
4592
4697
<divclass="paragraph">
4593
4698
<p>The issue is caused by the changes introduced by <ahref="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes" target="_blank" rel="noopener">Spring-Boot 3.2.0</a>
4594
4699
in particular for the <strong>Parameter Name Discovery</strong>.
* If you don't have the spring-boot and spring-boot-autoconfigure dependencies, you need to add them. And pay attention to the compatibility matrix, between you spring.version and spring-boot.version. For example, in this case (spring.version=5.1.12.RELEASE):
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
995
+
context.register(this.getClass(),
996
+
SpringDocConfiguration.class,
997
+
SpringDocConfigProperties.class,
998
+
SpringDocSpecPropertiesConfiguration.class,
999
+
SpringDocWebMvcConfiguration.class,
1000
+
MultipleOpenApiSupportConfiguration.class,
1001
+
SwaggerConfig.class,
1002
+
SwaggerUiConfigProperties.class,
1003
+
SwaggerUiOAuthProperties.class,
1004
+
SpringDocUIConfiguration.class
1005
+
);
1006
+
return context;
1007
+
}
1008
+
}
1009
+
----
1010
+
1011
+
* Depending on your module, you can find them on the file: `org.springframework.boot.autoconfigure.AutoConfiguration.imports` of each `springdoc-openapi` module.
1012
+
* For groups usage make sure your `GroupedOpenApi` Beans are scanned.
1013
+
* If additionally, you are using custom `context path`: `/my-servlet-path`. Make sure you declare the following property:
1014
+
[source,properties]
1015
+
----
1016
+
spring.mvc.servlet.path=/my-servlet-path
1017
+
----
1018
+
947
1019
=== What is the compatibility matrix of `springdoc-openapi` with `spring-boot` ?
948
1020
`springdoc-openapi 2.x` is compatible with `spring-boot 3`.
0 commit comments