<>错误介绍
2021-11-27 00:21:38.420 INFO 205300 --- [ main] o.apache.catalina.core.
StandardService : Stopping service [Tomcat] 2021-11-27 00:21:38.432 INFO 205300
--- [ main] ConditionEvaluationReportLoggingListener : Error starting
ApplicationContext. To display the conditions report re-run your application
with 'debug' enabled. 2021-11-27 00:21:38.449 ERROR 205300 --- [ main] o.s.boot.
SpringApplication : Application run failed org.springframework.context.
ApplicationContextException: Failed to start bean
'documentationPluginsBootstrapper'; nested exception is java.lang.
NullPointerException at org.springframework.context.support.
DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-
context-5.3.13.jar:5.3.13] at org.springframework.context.support.
DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring
-context-5.3.13.jar:5.3.13] at org.springframework.context.support.
DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:
356) ~[spring-context-5.3.13.jar:5.3.13] at java.lang.Iterable.forEach(Iterable.
java:75) ~[na:1.8.0_202] at org.springframework.context.support.
DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[
spring-context-5.3.13.jar:5.3.13] at org.springframework.context.support.
DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring
-context-5.3.13.jar:5.3.13] at org.springframework.context.support.
AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[
spring-context-5.3.13.jar:5.3.13] at org.springframework.context.support.
AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring
-context-5.3.13.jar:5.3.13] at org.springframework.boot.web.servlet.context.
ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.
java:145) ~[spring-boot-2.6.0.jar:2.6.0] at org.springframework.boot.
SpringApplication.refresh(SpringApplication.java:730) [spring-boot-2.6.0.jar:2.6
.0] at org.springframework.boot.SpringApplication.refreshContext(
SpringApplication.java:412) [spring-boot-2.6.0.jar:2.6.0] at org.springframework
.boot.SpringApplication.run(SpringApplication.java:302) [spring-boot-2.6.0.jar:
2.6.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:
1301) [spring-boot-2.6.0.jar:2.6.0] at org.springframework.boot.
SpringApplication.run(SpringApplication.java:1290) [spring-boot-2.6.0.jar:2.6.0]
atcom.wkb.ShiroApplication.main(ShiroApplication.java:11) [classes/:na] Caused
by: java.lang.NullPointerException: null at springfox.documentation.spi.service.
contexts.Orderings$8.compare(Orderings.java:112) ~[springfox-spi-2.9.2.jar:null]
atspringfox.documentation.spi.service.contexts.Orderings$8.compare(Orderings.
java:109) ~[springfox-spi-2.9.2.jar:null] at com.google.common.collect.
ComparatorOrdering.compare(ComparatorOrdering.java:37) ~[guava-20.0.jar:na] at
java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:1.8.0_202] at
java.util.TimSort.sort(TimSort.java:220) ~[na:1.8.0_202] at java.util.Arrays.
sort(Arrays.java:1438) ~[na:1.8.0_202] at com.google.common.collect.Ordering.
sortedCopy(Ordering.java:855) ~[guava-20.0.jar:na] at springfox.documentation.
spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(
WebMvcRequestHandlerProvider.java:57) ~[springfox-spring-web-2.9.2.jar:null] at
springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper$2.
apply(DocumentationPluginsBootstrapper.java:138) ~[springfox-spring-web-2.9.2.
jar:null] at springfox.documentation.spring.web.plugins.
DocumentationPluginsBootstrapper$2.apply(DocumentationPluginsBootstrapper.java:
135) ~[springfox-spring-web-2.9.2.jar:null] at com.google.common.collect.
Iterators$7.transform(Iterators.java:750) ~[guava-20.0.jar:na] at com.google.
common.collect.TransformedIterator.next(TransformedIterator.java:47) ~[guava-
20.0.jar:na] at com.google.common.collect.TransformedIterator.next(
TransformedIterator.java:47) ~[guava-20.0.jar:na] at com.google.common.collect.
MultitransformedIterator.hasNext(MultitransformedIterator.java:52) ~[guava-20.0.
jar:na] at com.google.common.collect.MultitransformedIterator.hasNext(
MultitransformedIterator.java:50) ~[guava-20.0.jar:na] at com.google.common.
collect.ImmutableList.copyOf(ImmutableList.java:249) ~[guava-20.0.jar:na] at com
.google.common.collect.ImmutableList.copyOf(ImmutableList.java:209) ~[guava-20.0
.jar:na] at com.google.common.collect.FluentIterable.toList(FluentIterable.java:
614) ~[guava-20.0.jar:na] at springfox.documentation.spring.web.plugins.
DocumentationPluginsBootstrapper.defaultContextBuilder(
DocumentationPluginsBootstrapper.java:111) ~[springfox-spring-web-2.9.2.jar:null
] at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper
.buildContext(DocumentationPluginsBootstrapper.java:96) ~[springfox-spring-web-
2.9.2.jar:null] at springfox.documentation.spring.web.plugins.
DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:167
) ~[springfox-spring-web-2.9.2.jar:null] at org.springframework.context.support.
DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-
context-5.3.13.jar:5.3.13] ... 14 common frames omitted Process finished with
exit code 1
我的swaggerConfig类如下
package com.wkb.config; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import
org.springframework.web.servlet.config.annotation.EnableWebMvc; import
springfox.documentation.builders.ApiInfoBuilder; import
springfox.documentation.builders.PathSelectors; import
springfox.documentation.builders.RequestHandlerSelectors; import
springfox.documentation.service.ApiInfo; import
springfox.documentation.spi.DocumentationType; import
springfox.documentation.spring.web.plugins.Docket; import
springfox.documentation.swagger2.annotations.EnableSwagger2; /** * @author */
@Configuration @EnableWebMvc public class SwaggerConfig{ @Bean public Docket
createRestApi(){ return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo
()) .select() //.apis(RequestHandlerSelectors.any()) .apis(
RequestHandlerSelectors.basePackage("com/wkb/controller")) .paths(
PathSelectors.any()) .build(); } private ApiInfo apiInfo(){ return new
ApiInfoBuilder() .title("SpringBoot API Doc") .description("This is a restful
api document of Spring Boot.") .version("1.0") .build(); } }
<>解决

在swaggerConfig类上加@EnableWebMvc

技术
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:766591547
关注微信