我已经将斯威格添加到我的 Spring Boot 2应用程序中:
这是我的斯威格配置:
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
// @formatter:off
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
// @formatter:on
}
}
这是 Maven 的依赖:
<!-- Swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
例如,当我尝试调用 http://localhost:8080/api/actuator/auditevents时,它失败了,并出现以下错误:
TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.
我做错了什么,如何弥补?