在CentOS上生成Swagger文檔,通??砂匆韵虏襟E進行:
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
查看和測試文檔。