swagger ui.html 405,Empty /swagger-ui.html - 404 /typography.css

Swagger-ui version: 2.7.0

Swagger-core version: 2.7.0

Content & configuration

Project tree (multi-module):

.

├── api

│   ├── build.gradle

│   └── src

│   └── main

│   └── java

│   └── com

│   └── example

│   └── api

│   └── controllers

│   ├── BarController.java

│   └── FooController.java

├── build.gradle

├── app

│   ├── build.gradle

│   ├── settings.gradle

│   └── src

│   └── main

│   ├── java

│   │   └── com

│   │   └── example

│   │   └── app

│   │   ├── AppApplication.java

│   │   └── security

│   │   └── WebSecurityConfiguration.java

│   │   └── swagger

│   │   └── Swagger2Configuration.java

│   └── resources

│   └── application.properties

└── core

├── build.gradle

└── src

└── main

└── java

└── com

└── example

└── core

├── model

│   └── Foo.java

├── repository

│   └── FooRepository.java

└── service

└── FooService.java

Swagger2Configuration:

@Configuration

@EnableSwagger2

public class Swagger2Configuration {

@Bean

public Docket api() {

return new Docket(DocumentationType.SWAGGER_2)

.select()

// .apis(RequestHandlerSelectors.basePackage("com.example")) - This didn't work either.

.apis(RequestHandlerSelectors.any())

.paths(PathSelectors.any())

.build();

}

}

configure function from WebSecurityConfiguration:

@Override

public void configure(WebSecurity web) throws Exception {

web

.ignoring()

.antMatchers("/v2/api-docs",

"/configuration/ui",

"/swagger-resources/**",

"/configuration/security",

"/swagger-ui.html",

"/webjars/**");

}

AppApplication:

@ComponentScan("com.example")

@EnableJpaRepositories("com.example.core.repository")

@EntityScan("com.example.core.model")

@SpringBootApplication

public class AppApplication {

public static void main(String... args) {

SpringApplication.run(AppApplication.class, args);

}

}

Screenshots

81fcdd2fb3baadb1a895b356f860a930.png

3dc5d5af6b21d6ca538e60c80893126e.png

I have a project that has three modules: api, app, and core. Endpoints are placed in the api module while service, model, and repository are placed in the core module. All configuration and @SpringBootApplication are placed in the app module.

I am able to see my endpoints and models on http://localhost:8080/v2/api-docs, but http://localhost:8080/swagger-ui.html shows nothing due to /typography.css - 404. How can I fix this issue?

Thanks.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值