springboot与swagger2冲突解决办法
报错:
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2023-06-09 11:20:32.782 ERROR 21988 — [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
原因:springboot2.7.12与swagger2.9.2冲突
springboot2.7.12与swagger2.9.2冲突原因:Springfox 假设 Spring MVC 的路径匹配策略是 ant-path-matcher,而 Spring Boot 2.6.x版本的默认匹配策略是 path-pattern-matcher,这就造成了上面的报错。
解决办法: 在application.properties 下添加spring.mvc.pathmatch.matching-strategy=ant_path_matcher (yaml按yaml格式来一样)
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)