Home > Back-end >  Ask questions about the use of swagger (online etc.! Be urgent!)
Ask questions about the use of swagger (online etc.! Be urgent!)

Time:05-18

current use maven hierarchical development, including maven - the parent project, the presence of maven - Commons and maven - A module, current springboot + mybatisplus environment, required depend on the package in A pom file directly under the parent module introduces directly, ask the question is, swagger - UI page cannot display the entity content of A module, but it can show the controller layer of all requests for content in A module, more confusing, want to be able to be resolved, in the swagger - UI. In the HTML display normal entity content + controller for content,

=========================================="

has introduced the swagger of relying on
 

IO. Springfox
Springfox - swagger2 & lt;/artifactId>
2.8.0 & lt;/version>


IO. Springfox
Springfox swagger - ui
2.8.0 & lt;/version>


Commons modules configured in the swagger
 
@ Configuration
@ EnableSwagger2
Public class SwaggerConfig {
@ Bean
The public Docket API () {
Return new Docket (DocumentationType SWAGGER_2)
ApiInfo (apiInfo ())
The select ()
Apis (RequestHandlerSelectors. BasePackage (" under the package at the same level "))
Paths (PathSelectors. Any ())
.build();
}

Private ApiInfo ApiInfo () {
Return new ApiInfoBuilder ()
. Title (" XXX ")
. The description (" XXX ")
Version (" 1.0 ")
.build();
}
}

Commons modules exist only in the entity class and tools related content, no springboot start bootstrap class, nor yml file configuration, entity class configuration section
 
@ ApiModelProperty (" success ")
Private Boolean flag.
@ ApiModelProperty (" status code ")
private Integer code;
@ ApiModelProperty (" state information ")
private String message;
@ ApiModelProperty (" return data ")
private Object data;

"======================================
in A module in the pom file references the Commons module, writing the controller (using the swagger related annotation), the service, the dao (mybatis plus), the entity (using the swagger related annotation), access to test A module, would have found the swagger - UI. HTML page in the models exist only in the Commons module entities in the content, but A module of entities in the content does not display, in addition, A module of the controller in each request to normal display in the swagger - UI. In HTML, request, A module of the entity where go to? How can ensure more modules can be fully Shared between swagger?

CodePudding user response:

Roughly know what is going on, still want to have a great god come over guidance, know how to solve, but I don't know how to understand,
  • Related