【SpringBoot项目集成Swagger2启动报错: Failed to start bean ‘documentationPluginsBootstrapper‘; nested except】

SpringBoot项目集成Swagger2启动报错: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is 问题解决

org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException

出现以上错误,是由Springfox的一个bug引起的,这是在假设SpringMVC是如何建立的,但这并不总是成立的。具体来说,它假设MVC的路径匹配将使用基于Ant-based的路径匹配器,而不是基于PathPattern-based的匹配器。基于PathPattern-based的匹配已经是一个选项,并且是SpringBoot2.6的默认选项。

如Spring Boot 2.6发行说明中所述,您可以通过在application.properties文件中将Spring.mvc.pathmatch.matching-strategy设置为ant path matcher来恢复Springfox假定将使用的配置。请注意,只有在不使用Spring Boot的执行器时,此功能才起作用。无论配置的匹配策略如何,执行器始终使用基于路径模式的解析。如果您想在Spring Boot 2.6及更高版本中将其与执行器一起使用,则需要对Springfox进行更改。

参考link

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值