最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Set up OpenAPI (Swagger) UI 3 in Spring Framework 6 - Stack Overflow

programmeradmin4浏览0评论

Tried a few suggestions in existing stackoverflow discussions but I can't even get the html page to serve, and almost all information on the web uses Spring Boot instead, does anyone have an article, video or a github repo where I can see how the correct configuration is set up? Using embedded jetty to serve if it matters

Tried a few suggestions in existing stackoverflow discussions but I can't even get the html page to serve, and almost all information on the web uses Spring Boot instead, does anyone have an article, video or a github repo where I can see how the correct configuration is set up? Using embedded jetty to serve if it matters

Share Improve this question asked Mar 17 at 12:17 OverdrowsedOverdrowsed 1197 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

It's possible to take advantage of springdoc-openapi-starter-webmvc-ui package and however you're bootstrapping the spring app, to just register its usual autoconfig classes manually. Add these to app context: SpringDocConfiguration, SwaggerConfig, SpringDocWebMvcConfiguration, JacksonAutoConfiguration and these beans somewhere in your configuration:

@Bean
SpringDocConfigProperties springDocConfigProperties() {
    return new SpringDocConfigProperties();
}

@Bean
SwaggerUiConfigProperties swaggerUiConfigProperties() {
    return new SwaggerUiConfigProperties();
}

@Bean
SwaggerUiOAuthProperties swaggerUiOAuthProperties() {
    return new SwaggerUiOAuthProperties();
}

if overriding configureMessageConverters,

converters.add(new ByteArrayHttpMessageConverter());

is needed

发布评论

评论列表(0)

  1. 暂无评论