Home > Back-end >  Using Swagger generated interface document only basic - error - controller
Using Swagger generated interface document only basic - error - controller

Time:04-08


Use MybatisPlus - annotated with Swagger of the generator to generate entity class, and then literally wrote a few only method signature interface (Swagger annotations are also written) want to test can run normally, results only as shown in figure

Before the questions have to ensure that the following details is no problem:
1. Entity classes and interfaces Swagger annotation
2. The main method with @ EnableSwagger2 SpringBoot start annotation
3. The Swagger configuration class
 
@ Configuration
@ EnableSwagger2
@ ComponentScan (" com.com mon. Controller ")
Public class SwaggerConfig {
@ Bean
The public Docket API () {
Return new Docket (DocumentationType SWAGGER_2)
ApiInfo (apiInfo ())
. PathMapping ("/")
The select ()
Apis (RequestHandlerSelectors. Any ())//
Apis (RequestHandlerSelectors. BasePackage (" com.com mon. Controller "))
.build();
}

Private ApiInfo ApiInfo () {
Return new ApiInfoBuilder ()
. Title (" interface document ")
Version (" 1.0.0 ")
TermsOfServiceUrl (" ")
License (" ")
LicenseUrl (" ")
.build();
}
}


Fastjson have also been discovered in the related question and answer the following version is too low, (comments as "upgrade version to 1.2.15 fastjson under + more than what I use is 1.2.28")
But has checked the MP dependence in as much as 1.2.72 fastjson version
  • Related