我试图访问 swagger ui 页面,但是当我要访问该页面时,出现此错误
此应用程序没有 /error 的显式映射,因此您将其视为后备
swagger Config 类
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.aluno"))
.paths(regex("/api.*"))
.build()
.apiInfo(metaInfo());
}
private ApiInfo metaInfo() {
ApiInfo apiInfo = new ApiInfo(
"Cursos API REST",
"API REST de registro de alunos.",
"1.0",
"Terms of Service",
new Contact("Romulo Sorato", "https://www.linkedin.com/in/r%C3%B4mulo-sorato-domingos-a6524437/",
"romulosorato@hotmail.com"),
"Apache License Version 2.0",
"https://www.apache.org/licesen.html", new ArrayList<>()
);
return apiInfo;
}
}
Run Code Online (Sandbox Code Playgroud)
我的 pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency> …
Run Code Online (Sandbox Code Playgroud)