簡體   English   中英

Swagger-ui空白白屏(Spring Boot-Swagger)

[英]Swagger-ui blank white screen (Spring Boot - Swagger)

當我將 Swagger 集成到 spring 項目中時,出現 Swagger 空白頁。 當我嘗試使用以下 url 撥打 Swagger 時,會出現一個空白頁面。 http://localhost:8081/swagger-ui.html

pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <version>2.7.4</version>
</dependency>
<dependency>
        <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.6.14</version>
</dependency>

主 class

@SpringBootApplication
public class ExampleMain {
    public static void main(String[] args) {
        SpringApplication.run(ExampleMain.class, args);
    }
}

應用程序.properties

server.port=8081
springdoc.swagger-ui.path=/swagger-ui.html

保安 class

@Configuration
@EnableWebSecurity
public class SecurityConfig {
    @Bean
    public SecurityFilterChain configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().antMatchers("/**").permitAll();
        return http.build();
    }
}

我該如何解決?

您是否嘗試過默認設置? 消除

springdoc.swagger-ui.path=/swagger-ui.html

和訪問

http://localhost:8081/swagger-ui/index.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM