#swagger引用引发启动异常报错:
org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
具体情况:
引用swagger之后报错,在启动类中注释掉swagger启动注解后项目启动正常。
报错内容:
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2023-10-30 15:02:49.658 ERROR 17092 — [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
解决方法
在application.yml或者其他格式的配置文件中进行配置
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
其他注意事项
值得注意的是方法中的注解如@ApiOperation(value = “手机获取验证码”,httpMethod = “get”,response = String.class)
中的httpMethod 后接方法应为全大写既应为GET否则会报错:(此报错仅为提示性报错不影响最终程序的运行,也可以不管)
java.lang.IllegalArgumentException: No enum constant org.springframework.web.bind.annotation.RequestMethod.post
对您有用的话点个赞吧