我可以通过@Api
,@ApiOperation
批注在Spring引导应用程序上生成swagger UI。
这些注释使代码有点脏。我想知道如何从javadocs为我的API端点生成详尽的文档。
最佳答案
有一个简单的方法,您必须添加@ EnableSwagger2批注。
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
@EnableSwagger2
public class Authentic {
public static void main(String[] args) {
SpringApplication.run(Authentic.class, args);
}
}
例如网址:http://localhost:8080/swagger-ui.html#/
关于java - 如何从javadocs生成Swagger UI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56788268/