【疑难杂症】org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.

问题介绍

今天在给服务器写接口的时候,突然出现了这个栈溢出的情况。网上搜不到问题和解决办法。看日志好像是跟文档有关。百思不得其解。好在知道引起错误的代码范围,用了一个笨办法,一个方法一个方法去对照。所幸最终找到了报错的原因。

本文由作者三汪首发于。

错误日志

2017-08-04 14:43:44.451  INFO 12156 --- [restartedMain] com.qipai.MemberMsApplication            : Starting MemberMsApplication on XM77025331 with PID 12156 (D:\dev\qipaiDev\workspace\member-ms\target\classes started by 77025331 in D:\dev\qipaiDev\workspace\member-ms)
2017-08-04 14:43:44.452  INFO 12156 --- [restartedMain] com.qipai.MemberMsApplication            : No active profile set, falling back to default profiles: default
2017-08-04 14:43:44.507  INFO 12156 --- [restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@25cd3a9a: startup date [Fri Aug 04 14:43:44 CST 2017]; root of context hierarchy
2017-08-04 14:43:46.044  WARN 12156 --- [restartedMain] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[com.qipai]' package. Please check your configuration.
2017-08-04 14:43:46.686  INFO 12156 --- [restartedMain] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-08-04 14:43:46.915  INFO 12156 --- [restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d2ba77fd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-08-04 14:43:47.082  INFO 12156 --- [restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'jsonConfig' of type [com.qipai.fw.config.JsonConfig$$EnhancerBySpringCGLIB$$e519a0d6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-08-04 14:43:47.563  INFO 12156 --- [restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-08-04 14:43:47.574  INFO 12156 --- [restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-08-04 14:43:47.575  INFO 12156 --- [restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.16
2017-08-04 14:43:47.715  INFO 12156 --- [localhost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-08-04 14:43:47.715  INFO 12156 --- [localhost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3210 ms
2017-08-04 14:43:47.938  INFO 12156 --- [localhost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-08-04 14:43:47.944  INFO 12156 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-08-04 14:43:47.945  INFO 12156 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-08-04 14:43:47.945  INFO 12156 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-08-04 14:43:47.945  INFO 12156 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-08-04 14:43:47.946  INFO 12156 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestParmFilter' to urls: [/*]
2017-08-04 14:43:47.946  INFO 12156 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'corsFilter' to: [/*]
2017-08-04 14:43:48.685  INFO 12156 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-08-04 14:43:48.701  INFO 12156 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2017-08-04 14:43:48.788  INFO 12156 --- [restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2017-08-04 14:43:48.790  INFO 12156 --- [restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-08-04 14:43:48.792  INFO 12156 --- [restartedMain] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-08-04 14:43:48.842  INFO 12156 --- [restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-08-04 14:43:48.986  INFO 12156 --- [restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2017-08-04 14:43:49.265  WARN 12156 --- [restartedMain] org.hibernate.id.UUIDHexGenerator        : HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
2017-08-04 14:43:49.487  INFO 12156 --- [restartedMain] org.hibernate.tuple.PojoInstantiator     : HHH000182: No default (no-argument) constructor for class: com.qipai.member.api.shared.domain.WxDictDomain (class must be instantiated by Interceptor)
2017-08-04 14:43:49.628  INFO 12156 --- [restartedMain] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000228: Running hbm2ddl schema update
2017-08-04 14:43:50.010  INFO 12156 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-08-04 14:43:53.215  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/bonus_point/add],methods=[POST]}" onto public void com.qipai.member.server.web.BonusPointController.addBonusPointRecord(com.qipai.member.api.shared.vo.AddBonusPointsRecordVo)
2017-08-04 14:43:53.217  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/bonus_point/get/{memberCode}],methods=[GET]}" onto public java.util.List com.qipai.member.server.web.BonusPointController.findByMemberCode(java.lang.String)
2017-08-04 14:43:53.222  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/label/member/delete/{id}],methods=[DELETE]}" onto public void com.qipai.member.server.web.LabelController.deleteMemberLabel(java.lang.String)
2017-08-04 14:43:53.222  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/label/member/add_fixed],methods=[POST]}" onto public void com.qipai.member.server.web.LabelController.addFixedMemberLabel(com.qipai.member.api.shared.domain.MemberLabelDomain)
2017-08-04 14:43:53.222  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/label/member/add_personal],methods=[POST]}" onto public void com.qipai.member.server.web.LabelController.addPersonalMemberLabel(com.qipai.member.api.shared.domain.MemberDomain,com.qipai.member.api.shared.domain.LabelDictDomain)
2017-08-04 14:43:53.222  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/label/member/get/{memberCode}],methods=[GET]}" onto public java.util.List com.qipai.member.server.web.LabelController.searchMemberLabel(java.lang.String)
2017-08-04 14:43:53.223  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/label/dict/delete/{id}],methods=[DELETE]}" onto public void com.qipai.member.server.web.LabelController.deleteLabelDict(java.lang.String)
2017-08-04 14:43:53.223  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/label/dict/add],methods=[POST]}" onto public void com.qipai.member.server.web.LabelController.addLabelDict(com.qipai.member.api.shared.domain.LabelDictDomain)
2017-08-04 14:43:53.223  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/label/dict/search],methods=[GET]}" onto public java.util.List com.qipai.member.server.web.LabelController.searchLabelDict(java.lang.String,java.lang.String,java.lang.String)
2017-08-04 14:43:53.224  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/member/searchMemberByVo],methods=[GET]}" onto public org.springframework.data.domain.Page com.qipai.member.server.web.MemberController.searchMemberByVo(com.qipai.member.api.shared.vo.MemberSearchVo,int,int)
2017-08-04 14:43:53.225  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/v2/api-docs],methods=[GET],produces=[application/json || application/hal+json]}" onto public org.springframework.http.ResponseEntity springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)
2017-08-04 14:43:53.228  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/ui]}" onto org.springframework.http.ResponseEntity springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2017-08-04 14:43:53.229  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources]}" onto org.springframework.http.ResponseEntity> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()
2017-08-04 14:43:53.230  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/security]}" onto org.springframework.http.ResponseEntity springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2017-08-04 14:43:53.233  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-08-04 14:43:53.233  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-08-04 14:43:53.634  INFO 12156 --- [restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@25cd3a9a: startup date [Fri Aug 04 14:43:44 CST 2017]; root of context hierarchy
2017-08-04 14:43:53.693  INFO 12156 --- [restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-08-04 14:43:53.694  INFO 12156 --- [restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-08-04 14:43:53.715  INFO 12156 --- [restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in globalExceptionHandler
2017-08-04 14:43:53.743  INFO 12156 --- [restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-08-04 14:43:54.188  INFO 12156 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2017-08-04 14:43:54.246  INFO 12156 --- [restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-08-04 14:43:54.255  INFO 12156 --- [restartedMain] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 2147483647
2017-08-04 14:43:54.255  INFO 12156 --- [restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2017-08-04 14:43:54.277  INFO 12156 --- [restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2017-08-04 14:43:54.326  INFO 12156 --- [restartedMain] s.d.s.w.s.ApiListingReferenceScanner     : Scanning for api listing references
2017-08-04 14:43:54.761  WARN 12156 --- [restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.StackOverflowError
2017-08-04 14:43:54.762  INFO 12156 --- [restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2017-08-04 14:43:54.768  INFO 12156 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-08-04 14:43:54.773  INFO 12156 --- [restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2017-08-04 14:43:54.775  INFO 12156 --- [localhost-startStop-1] c.q.fw.core.filter.WebRequestParmFilter  : 过滤器销毁
2017-08-04 14:43:54.788  INFO 12156 --- [restartedMain] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-08-04 14:43:54.799 ERROR 12156 --- [restartedMain] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.StackOverflowError
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)  ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:50) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:348) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:151) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:114) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:880) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at com.qipai.MemberMsApplication.main(MemberMsApplication.java:12) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.6.RELEASE.jar:1.5.6.RELEASE]
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.StackOverflowError
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2216) ~[guava-22.0.jar:na]
    at com.google.common.cache.LocalCache.get(LocalCache.java:4147) ~[guava-22.0.jar:na]
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151) ~[guava-22.0.jar:na]
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140) ~[guava-22.0.jar:na]
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5146) ~[guava-22.0.jar:na]
    at springfox.documentation.spring.web.scanners.CachingOperationReader.read(CachingOperationReader.java:57) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.scanners.ApiDescriptionReader.read(ApiDescriptionReader.java:66) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:89) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:70) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationPluginsBootstrapper.java:85) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:127) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    ... 19 common frames omitted
Caused by: java.lang.StackOverflowError: null
    at com.fasterxml.classmate.util.ResolvedTypeCache$Key.equals(ResolvedTypeCache.java:153) ~[classmate-1.3.3.jar:1.3.3]
    at java.util.HashMap.getNode(HashMap.java:571) ~[na:1.8.0_121]
    at java.util.LinkedHashMap.get(LinkedHashMap.java:440) ~[na:1.8.0_121]
    at com.fasterxml.classmate.util.ResolvedTypeCache.find(ResolvedTypeCache.java:53) ~[classmate-1.3.3.jar:1.3.3]
    at com.fasterxml.classmate.TypeResolver._fromClass(TypeResolver.java:366) ~[classmate-1.3.3.jar:1.3.3]
    at com.fasterxml.classmate.TypeResolver._fromAny(TypeResolver.java:312) ~[classmate-1.3.3.jar:1.3.3]
    at com.fasterxml.classmate.TypeResolver.resolve(TypeResolver.java:174) ~[classmate-1.3.3.jar:1.3.3]
    at com.fasterxml.classmate.ResolvedTypeWithMembers.resolveField(ResolvedTypeWithMembers.java:551) ~[classmate-1.3.3.jar:1.3.3]
    at com.fasterxml.classmate.ResolvedTypeWithMembers.resolveMemberFields(ResolvedTypeWithMembers.java:300) ~[classmate-1.3.3.jar:1.3.3]
    at com.fasterxml.classmate.ResolvedTypeWithMembers.getMemberFields(ResolvedTypeWithMembers.java:193) ~[classmate-1.3.3.jar:1.3.3]
    at springfox.documentation.schema.property.field.FieldProvider.in(FieldProvider.java:47) ~[springfox-schema-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:80) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]
    at springfox.documentation.spring.web.readers.parameter.ModelAttributeParameterExpander.expand(ModelAttributeParameterExpander.java:94) ~[springfox-spring-web-2.6.1.jar:2.6.1]

问题的原因

项目是基于Spring Boot搭建的RESTFUL风格的项目。在写Controller的时候,封装了两层。一个是接口,一个是具体实现。问题的原因就出在了实现类的Controller中方法的参数没有加注解,只在接口中写了注解。把注解加上,问题就解决了。
下面是问题代码:
ILabelController

@RequestMapping("/label")
public interface ILabelController {

    @ApiOperation(value = "新增标签")
    @RequestMapping(value = "/dict/add", method = RequestMethod.POST)
    void addLabelDict(@RequestBody @Valid LabelDictDomain labelDict);
    
    @ApiOperation(value = "删除标签")
    @RequestMapping(value = "/dict/delete/{id}" , method = RequestMethod.DELETE)
    void deleteLabelDict(@PathVariable("id")String id);
    
    @ApiOperation(value = "对标签字典的复合查询", notes = "对标签字典的复合查询")
    @RequestMapping(value = "/dict/search", method = RequestMethod.GET)
    List searchLabelDict(@RequestParam(value = "name", required = false)String labelName,
            @RequestParam(value = "type", required = false)String labelType, 
            @RequestParam(value = "group", required = false)String labelGroup);
    
    @ApiOperation(value = "新增或修改一个会员固定标签", notes = "新增或修改一个会员固定标签")
    @RequestMapping(value = "/member/add_fixed", method = RequestMethod.POST)
    void addFixedMemberLabel(@RequestBody @Valid MemberLabelDomain memberLabel);
    
    @ApiOperation(value = "新增或修改一个会员个性标签", notes = "新增或修改一个会员个性标签")
    @RequestMapping(value = "/member/add_personal", method = RequestMethod.POST)
    void addPersonalMemberLabel(@RequestBody @Valid @NotNull MemberDomain memberDomain,@RequestBody @Valid @NotNull LabelDictDomain labelDictDomain);

    @ApiOperation(value = "删除会员标签", notes = "删除会员标签")
    @RequestMapping(value = "/member/delete/{id}", method = RequestMethod.DELETE)
    void deleteMemberLabel(@PathVariable("id")String id);
    
    @ApiOperation(value = "获取会员标签", notes = "获取会员标签")
    @RequestMapping(value = "/member/get/{memberCode}", method = RequestMethod.GET)
    List searchMemberLabel(@PathVariable("memberCode")String memberCode);
}

LabelController

@RestController
public class LabelController implements ILabelController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    ILabelDictService dictService;
    @Autowired
    IMemberLabelService memberLabelService;
    @Override
    public void addLabelDict(LabelDictDomain labelDict) {
        dictService.save(labelDict);
    }
    
    @Override
    public void deleteLabelDict(String id) {
        dictService.deleteById(id);
        
    }

    @Override
    public List searchLabelDict(String labelName,String labelType, String labelGroup) {
        return dictService.findLabelByKey(labelName, labelType, labelGroup);
    }

    @Override
    public void addFixedMemberLabel(MemberLabelDomain memberLabel) {
        memberLabelService.save(memberLabel);
    }

    @Override
    public void addPersonalMemberLabel(MemberDomain memberDomain, LabelDictDomain labelDictDomain) {
        logger.info("新增会员个性标签");
        dictService.save(labelDictDomain);
        LabelDictDomain label = dictService.findLabelByLabelName(labelDictDomain.getLabelName());
        memberLabelService.setMemberLabel(new MemberLabelDomain(memberDomain,label));
        
    }

    @Override
    public void deleteMemberLabel(String id) {
        memberLabelService.deleteById(id);
        
    }

    @Override
    public List searchMemberLabel(String memberCode) {
        logger.info("查询会员标签");
        List list = memberLabelService.getMemberLabels(memberCode);
        List listReturn = new ArrayList<>();
        for (MemberLabelDomain memberLabelDomain : list) {
            listReturn.add(memberLabelDomain.getLabelDictDomain());
        }
        return listReturn;
    }



}

解决问题修改的代码

LabelController

@RestController
public class LabelController implements ILabelController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    ILabelDictService dictService;
    @Autowired
    IMemberLabelService memberLabelService;
    @Override
    public void addLabelDict(@RequestBody @Valid LabelDictDomain labelDict) {
        dictService.save(labelDict);
    }
    
    @Override
    public void deleteLabelDict(@PathVariable("id")String id) {
        dictService.deleteById(id);
        
    }

    @Override
    public List searchLabelDict(@RequestParam(value = "name", required = false)String labelName,
            @RequestParam(value = "type", required = false)String labelType, 
            @RequestParam(value = "group", required = false)String labelGroup) {
        return dictService.findLabelByKey(labelName, labelType, labelGroup);
    }

    @Override
    public void addFixedMemberLabel(@RequestBody @Valid  MemberLabelDomain memberLabel) {
        memberLabelService.save(memberLabel);
    }

    @Override
    public void addPersonalMemberLabel(@RequestBody @Valid @NotNull MemberDomain memberDomain, @RequestBody @Valid @NotNull LabelDictDomain labelDictDomain) {
        logger.info("新增会员个性标签");
        dictService.save(labelDictDomain);
        LabelDictDomain label = dictService.findLabelByLabelName(labelDictDomain.getLabelName());
        memberLabelService.setMemberLabel(new MemberLabelDomain(memberDomain,label));
        
    }

    @Override
    public void deleteMemberLabel(@PathVariable("id")String id) {
        memberLabelService.deleteById(id);
        
    }

    @Override
    public List searchMemberLabel(@PathVariable("memberCode")String memberCode) {
        logger.info("查询会员标签");
        List list = memberLabelService.getMemberLabels(memberCode);
        List listReturn = new ArrayList<>();
        for (MemberLabelDomain memberLabelDomain : list) {
            listReturn.add(memberLabelDomain.getLabelDictDomain());
        }
        return listReturn;
    }



}

THE END

希望我的文章对你能有所帮助。
有什么意见、见解或疑惑,欢迎留言讨论。

你可能感兴趣的:(【疑难杂症】org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.)