程序包io.swagger.annotations不存在

报错:程序包io.swagger.annotations不存在

解决方法:

这个错误提示是因为在你的代码中使用了Swagger注解,但是你的项目中没有引入Swagger的相关依赖包,需要在pom.xml文件中添加以下依赖:

<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>

添加完依赖后,重新编译运行即可。

猜你喜欢

转载自blog.csdn.net/m0_57954117/article/details/129825722