SoFunction
Updated on 2025-04-13

SpringBoot2. Compatibility with Swagger3 and solutions

Report an error:

Failed to start bean 'documentationPluginsBootstrapper'; nested exception is

solve:

If not introduced in the projectspring-boot-starter-actuator, add the following configuration directly to the yml file:

spring:
  mvc:
    pathmatch:
      matching-strategy: ant-path-matcher

​ Otherwise, add the following configuration:

@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 = ();
    (webEndpoints);
    (());
    (());
    String basePath = ();
    EndpointMapping endpointMapping = new EndpointMapping(basePath);
    boolean shouldRegisterLinksMapping = (webEndpointProperties, environment, basePath);
    return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, (), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, null);
}
private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) {
    return ().isEnabled() && ((basePath) || (environment).equals());
}

This is the end of this article about SpringBoot2. Compatibility issues with Swagger3. For more related SpringBoot2. Compatibility issues with Swagger3, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!