<dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-spring-boot-starter</artifactId> <version>2.0.9</version> </dependency>
1.可以尝试clean 再刷新maven
2.从中央仓库中重新加载
快捷键:Ctrl+Alt+Shift+S
或者file下打开Project Structure...
选择上面的+号,.m2文件夹下,如果有下载好的 knife4j 文件可以全部删除或者移动到别的位置,再继续添加,也可以选择Jar 找到knife4j文件指定其中一个文件,把上图中报错的knife4j删除掉,启动工程,没有问题就可以了。
错误二:
Consider defining a bean of type 'com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver' in your configuration.
在application.yml中配置
knife4j: enable: true
错误三:
报空指针异常:
1.可能某个依赖没有添加<scope>标签,例如:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency>
2.可能不支持当前项目版本号,改版本号
文章来源地址https://www.toymoban.com/news/detail-657119.html文章来源:https://www.toymoban.com/news/detail-657119.html
到了这里,关于knife4j依赖报错-----------解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!