Error creating bean with name 'documentationPluginsBootstrapper'及访问swagger2出现404


Error creating bean with name 'documentationPluginsBootstrapper是因为没有在配置类加@EnableWebMvC注解
@Configuration
@EnableSwagger2
还有这两个注解



访问swagger2出现404需要写如下配置类才能够访问

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
}
}

麻了,跟着做谷粒学院项目,视频都没提到这些都能运行,搜了很久什么版本原因搞的心态差点蹦了