在CentOS上生成Swagger文档,通常可按以下步骤进行:
sudo yum install -y java-1.8.0-openjdk-devel安装Java,用sudo yum install -y maven安装Maven。pom.xml中添加Swagger依赖,如springfox-swagger2和springfox-swagger-ui。@Configuration和@EnableSwagger2注解。@Api、@ApiOperation等。mvn clean package命令生成,文档位于target/generated-sources/swagger目录。http://localhost:8080/swagger-ui.html查看和测试文档。