报错:
failed to start bean 'documentationpluginsbootstrapper'; nested exception is java.lang.nullpointerexception
解决:
如果项目中未引入 spring-boot-starter-actuator,则直接在 yml 文件中加入如下配置:
spring:
mvc:
pathmatch:
matching-strategy: ant-path-matcher 反之再添加如下配置:
@bean
public webmvcendpointhandlermapping webendpointservlethandlermapping(webendpointssupplier webendpointssupplier, servletendpointssupplier servletendpointssupplier, controllerendpointssupplier controllerendpointssupplier, endpointmediatypes endpointmediatypes, corsendpointproperties corsproperties, webendpointproperties webendpointproperties, environment environment) {
list<exposableendpoint<?>> allendpoints = new arraylist();
collection<exposablewebendpoint> webendpoints = webendpointssupplier.getendpoints();
allendpoints.addall(webendpoints);
allendpoints.addall(servletendpointssupplier.getendpoints());
allendpoints.addall(controllerendpointssupplier.getendpoints());
string basepath = webendpointproperties.getbasepath();
endpointmapping endpointmapping = new endpointmapping(basepath);
boolean shouldregisterlinksmapping = this.shouldregisterlinksmapping(webendpointproperties, environment, basepath);
return new webmvcendpointhandlermapping(endpointmapping, webendpoints, endpointmediatypes, corsproperties.tocorsconfiguration(), new endpointlinksresolver(allendpoints, basepath), shouldregisterlinksmapping, null);
}
private boolean shouldregisterlinksmapping(webendpointproperties webendpointproperties, environment environment, string basepath) {
return webendpointproperties.getdiscovery().isenabled() && (stringutils.hastext(basepath) || managementporttype.get(environment).equals(managementporttype.different));
}到此这篇关于springboot2.6.x 与 swagger3 兼容问题的文章就介绍到这了,更多相关springboot2.6.x 与 swagger3 兼容问题内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!
发表评论