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: