spring boot使用swagger的ApiOperation注解

背景:

如果要使用@ApiOperation注解,需要引入swagger,而不是引入OpenAPI。

 

在父工程的pom.xml里添加swagger的依赖:

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.2.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.2.2</version>
        </dependency>

 

这样就可以在controller里使用@ApiOperation注解了,通过浏览器访问http://localhost:8088/swagger-ui.html

 

 

 

参考资料:

https://www.cnblogs.com/liaojie970/p/8185276.html

posted @ 2022-05-04 08:13  jamstack  阅读(756)  评论(0编辑  收藏  举报