ring引导requestMappingHandlerMappi

ring引导requestMappingHandlerMappi

本文介绍了Spring引导requestMappingHandlerMapping java.lang.ArrayStoreException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:奇怪的是,只有在使用Gradle构建jar时,才会引发此错误。 Maven生成的jar运行正常!所以我目前正在探索如何以及如何使用我的gradle构建脚本/弹簧引导配置失败。



我有一个Spring引导应用程序抛出以下错误:

  ========================= 
AUTO-配置报告
=========================

正匹配:
---- -------------

DataSourceAutoConfiguration
- 找到的@ConditionalOnClass类:org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType(OnClassCondition)

DataSourceAutoConfiguration.DataSourceInitializerConfiguration
- @ConditionalOnMissingBean(类型:org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer; SearchStrategy:所有)没有发现豆(OnBeanCondition)

DataSourceTransactionManagerAutoConfiguration
- 找到的@ConditionalOnClass类:org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionMana ger(OnClassCondition)

DataSourceTransactionManagerAutoConfiguration.TransactionManagementConfiguration
- @ConditionalOnMissingBean(类型:org.springframework.transaction.annotation.AbstractTransactionManagementConfiguration; SearchStrategy:所有)没有发现豆(OnBeanCondition)

DispatcherServletAutoConfiguration
- 发现Web应用程序StandardServletEnvironment(OnWebApplicationCondition)
- 发现@ConditionalOnClass类:org.springframework.web.servlet.DispatcherServlet (OnClassCondition)

DispatcherServletAutoConfiguration.DispatcherServletConfiguration
- 找不到ServletRegistrationBean(DispatcherServletAutoConfiguration.DefaultDispatcherServletCondition)
- 找到@ConditionalOnClass类:javax.servlet.ServletRegistration(OnClassCondition)

EmbeddedServletContainerAutoConfiguration
- 发现Web应用程序StandardServletEnvironment(OnWebApplicationCondition)

EmbeddedServletContainerAutoConfiguration.EmbeddedTomcat
- @ConditionalOnClass发现类:javax.servlet.Servlet,org.apache.catalina.startup .Tomcat(OnClassCondition)
- @ConditionalOnMissingBean(类型:org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; SearchStrategy:current)发现没有bean(OnBeanCondition)

ErrorMvcAutoConfiguration
- @ConditionalOnClass找到的类:javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet(OnClassCondition)
- 找到web应用程序StandardServletEnvironment(OnWebApplicationCondition)

ErrorMvcAutoConfiguration#basicErrorController
- @ConditionalOnMissingBean(类型:org.springframework.boot.autoconfigure.web.ErrorController; SearchStrategy:current)found no beans( OnBeanCondition)

ErrorMvcAutoConfiguration#errorAttributes
- @ConditionalOnMissingBean(类型:org.springframework.boot.autoconfigure.web.ErrorAttributes; SearchStrategy:current)找不到bean(OnBeanCondition)

ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration
- 未检测到错误模板视图(ErrorMvcAutoConfiguration.ErrorTemplateMissingCondition)
- 上org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration $ WhitelabelErrorViewConfiguration使用SpEL表达:$ {error.whitelabel.enabled:真}(OnExpressionCondition)

ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration#beanNameViewResolver
- @ ConditionalOnMissingBean(类型:org.springframework.web.servlet.view.BeanNameViewResolver; SearchStrategy:all)找不到bean(OnBeanCondition)

ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration#defaultErrorView
- @ConditionalOnMissingBean(names:error; SearchStrategy:all)found no beans(OnBeanCondition)

HttpMessageConvertersAutoConfiguration
- 找到的@ConditionalOnClass类:org.springframework.http.converter.HttpMessageConverter(OnClassCondition)

HttpMessageConvertersAutoConfiguration#messageConverters
- @ConditionalOnMissingBean(类型:org.springframework .boot.autoconfigure.web.HttpMessageConverters; SearchStrategy:all)找不到bean(OnBeanCondition)

HttpMessageConvertersAutoConfiguration.ObjectMappers
- 找到的@ConditionalOnClass类:com.fasterxml.jackson.databind.ObjectMapper( OnClassCondition)

HttpMessageConvertersAutoConfiguration.ObjectMappers#mappingJackson2HttpMessageConverter
- @ConditionalOnMissingBean(类型:org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; SearchStrategy:all)找不到bean(OnBeanCondition)

JacksonAutoConfiguration $ b $ - 找到的@ConditionalOnClass类:com.fasterxml.jackson.databind.ObjectMapper(OnClassCondition)

JacksonAutoConfiguration .JacksonObjectMapperAutoConfiguration
- 找到的@ConditionalOnClass类:com.fasterxml.jackson.databind.ObjectMapper(OnClassCondition)
$ b JmxAutoConfiguration
- 找到的@ConditionalOnClass类:org.springframework.jmx.export .MBeanExporter(OnClassCondition)
- org.springframework.boot.autocon fig.jmx.JmxAutoConfiguration上的SpEL表达式:$ {spring.jmx.enabled:true}(OnExpressionCondition)

JmxAutoConfiguration#mbeanServer
- @ConditionalOnMissingBean(类型:javax.management.MBeanServer; SearchStrategy:全部)找不到bean(OnBeanCondition)

MultipartAutoConfiguration
- 找到@ConditionalOnClass类:jav ax.servlet.Servlet,org.springframework.web.multipart.support.StandardServletMultipartResolver,javax.servlet.MultipartConfigElement(OnClassCondition)
- 上org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration使用SpEL表达式:$ {多。 enabled:true}(OnExpressionCondition)

MultipartAutoConfiguration#multipartConfigElement
- @ConditionalOnMissingBean(types:javax.servlet.MultipartConfigElement; SearchStrategy:所有)没有发现豆(OnBeanCondition)

MultipartAutoConfiguration#multipartResolver
- @ConditionalOnMissingBean(类型:org.springframework.web.multipart.support.StandardServletMultipartResolver; SearchStrategy:所有)未发现豆(OnBeanCondition)

ServerPropertiesAutoConfiguration
- 发现Web应用程序StandardServletEnvironment(OnWebApplicationCondition)

ServerPropertiesAutoConfiguration#serverProperties
- @ConditionalOnMissingBean(类型:org.springframework.boot .autoconfigure.web.ServerProperties; SearchStrategy:current)发现没有bean(OnBeanCondition)

WebMvcAutoConfiguration
- 找到的web应用程序StandardServletEnvironment(OnWebApplicationCondition)
- 找到的@ConditionalOnClass类:javax。 servlet.Servlet,org.springframework.web.servlet.DispatcherServlet,org.springframework.web.servlet.config.annotation.WebMvcC onfigurerAdapter(OnClassCondition)
- @ConditionalOnMissingBean(类型:org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; SearchStrategy:all)找不到bean(OnBeanCondition)

WebMvcAutoConfiguration#hiddenHttpMethodFilter $ b $ - @ConditionalOnMissingBean(类型:org.springframework.web.filter.HiddenHttpMethodFilter; SearchStrategy:全部)找不到bean(OnBeanCondition) )

WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver
- @ConditionalOnBean(类型:org.springframework.web.servlet.View; SearchStrategy:all)发现以下[error](OnBeanCondition)

WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#defaultViewResolver
- @ConditionalOnMissingBean(类型:org.springframework.web.servlet.view.InternalResourceViewResolver; SearchStrategy:所有)没有发现豆(OnBeanCondition)

WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#requestContextListener
- @ConditionalOnMissingBean(类型:org.springframework.web.context.request.RequestContextListener; Se archStrategy:all)找不到bean(OnBeanCondition)

WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#viewResolver
- @ConditionalOnBean(类型:org.springframework.web.servlet.ViewResolver; SearchStrategy:all)找到下列[b​​eanNameViewResolver,defaultViewResolver] @ConditionalOnMissingBean(names:viewResolver; SearchStrategy:all)找不到bean(OnBeanCondition)


负值匹配:
- ---------------

....
....
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#dateFormatter
- @ ConditionalOnProperty缺少必需属性:未找到日期格式(OnPropertyCondition)

WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#localeResolver
- @ConditionalOnMissingBean(类型:org.springframework.web.servlet.LocaleResolver; SearchStrategy:all) (OnBeanCondition)
- @ConditionalOnProperty缺少必需的属性:找不到locale(OnPropertyCondition)

WebSocketAutoConfiguration $ b $ - 必需@ConditionalOnClass未找到类:org.springframework.web。 socket.WebSocketHandler,org.apache.tom cat.websocket.server.WsSci(OnClassCondition)


$ b 15:11:13.684 [main] ERROR osboot.SpringApplication - 应用程序启动失败
org.springframework .beans.factory.BeanCreationException:在类路径资源[org / springframework / web / servlet / config / annotation / DelegatingWebMvcConfiguration.class]中定义名称为'requestMappingHandlerMapping'的bean时出错:init方法的调用失败;嵌套异常是java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy
。在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)〜[弹簧豆-4.0.7 .RELEASE.jar:4.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)〜[spring-beans-4.0.7.RELEASE.jar: 4.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)〜[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE ]
at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:302)〜[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.ja va:228)〜[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)〜 [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)〜[spring-beans- 4.0.7.RELEASE.jar:4.0.7.RELEASE]
在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706)〜[spring-beans-4.0.7.RELEASE .jar:4.0.7.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)〜[spring-context-4.0.7.RELEASE.jar:4.0.7。
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)〜[spring-context-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.boot.contex t.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)〜[spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication .java:691)[spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
线程main中的异常org.springframework.beans.factory.BeanCreationException:创建名为' requestMappingHandlerMapping'在类路径资源[org / springframework / web / servlet / config / annotation / DelegatingWebMvcConfiguration.class]中定义:调用init方法失败;嵌套异常是java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
at org.springframework。 beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
处org.springframework org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
。 beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework .beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706)
在org.springframework.boot.SpringApplication.run( SpringApplication.java:320)[spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)[spring-boot -1.1.6.RELEASE.jar:1.1.6.RELEASE]
与目标VM断开连接,地址:'127.0.0.1:61052',transport:'socket'
,位于org.springframework.boot .SpringApplication.run(SpringApplication.java:941)[spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
at org.ihc.phr.status.Initializer.main(Initializer.java :17)[main /:na]
引起:java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitializat ion(AbstractApplicationContext.java:762)
at org.springframework.context.support处的sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)〜[na:1.8.0_20]
。 AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh( SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
在org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
在org.ihc.phr.status.Initializer.main(Initializer.java:17)
导致:java .lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.An notationParser.parseClassArray(AnnotationParser.java:724)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java: 531)〜[na:1.8.0_20]
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)〜[na:1.8.0_20]
at sun.reflect.annotation。 AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)〜[na:1.8.0_20]
at sun.reflect.annotation。 AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
在sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
在sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java: 120)〜[na:1.8.0_20]
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.ja va:72)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)〜[na:1.8.0_20]
at java.lang.Class.createAnnotationData(Class.java: 3508)
at java.lang.Class.createAnnotationData(Class.java:3508)〜[na:1.8.0_20]
at java.lang.Class.annotationData(Class.java:3497)
at java.lang.Class.createAnnotationData(Class.java:3513)$ b $ at java.lang.Class.annotationData(Class.java:3497)
at java.lang.Class.getDeclaredAnnotations(Class .java:3464)
at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:352)
at java.lang.Class.annotationData(Class.java:3497)〜[na :1.8.0_20]
at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:319)
at java.lang.Class.createAnnotationData(Class.java:3513)〜[na :1.8.0_20]
at org.springframework.web.servlet.mvc.method.annotation.Re questMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:173)
at java.lang.Class.annotationData(Class.java:3497)〜[na:1.8.0_20]
at org.springframework.web.servlet。 handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:123)
at java.lang.Class.getDeclaredAnnotations(Class.java:3464)〜[na:1.8.0_20]
at org.springframework.web。 servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103)
在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126)
。在组织。 springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
在org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:352)〜[spring-core-4.0.7 .RELEASE.jar:4.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
... 15 more
at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils .java:319)〜[spring-core-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping。 java:173)〜[spring-webmvc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:123)〜 [spring-webmvc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103)〜[spring-webmvc- 4.0.7.RELEASE.jar:4.0.7.RELEASE]
在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHa在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory .java:1613)〜[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) 〜[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
... 15个常见框架省略
:bootRun失败

失败:构建失败除了例外。

初始化程序:

  @Configuration 
@ComponentScan(basePackages = {com.mycompany,
com.mycompany.utils,
com.mycompany.domain,com。 mycompany.resources,
com.mycompany.resources.hook})
@EnableAutoConfiguration
public class Initializer {

public static void main(String []] args){
SpringApplication.run(Initializer.class,args);
}


}

配置类

  @Configuration 
@EnableAsync
@EnableScheduling
@PropertySource(classpath:application-dev .properties)
@ImportResource(value =classpath:applicationContext.xml)
@ComponentScan(basePackages = {
com.mycompany.web})
public class StatusConfiguration {
@Autowired
环境环境;

@Bean
public ObjectMapper jacksonObjectMapper(){
返回新的CustomObjectMapper();


$Be
public TargetServer targetServer(){
TargetServer targetServer = new TargetServer();
targetServer.setJndiValidationConnectionURL(env.getProperty(jndiValidationConnectionURL));
targetServer.setJndiValidationUsername(env.getProperty(jndiValidationUsername));
targetServer.setJndiValidationPassword(env.getProperty(jndiValidationPassword));
返回targetServer;




$ b $控制器

  @RestController 
public class StatusController {
$ b $ @Autowired
Private ReportService reportService;

@Autowired
私有TargetServer targetServer;

private Logger log = LoggerFactory.getLogger(StatusController.class);

@RequestMapping(value =/ report)

MyReport getStatus(){
MyReport report = reportService.getReport();
返回报告;


@RequestMapping(value =/ report / no-cache)
public MyReport getStatusNoCache(){$ b $ autoRunReport();
MyReport report = reportService.getReport();
返回报告;
}


@Scheduled(fixedDelay = 300000)
public void autoRunReport(){
reportService.kickOffReport(targetServer);
log.debug(运行计划的验证报告!);
}

}

Gradle配置

  apply plugin:'java'
apply plugin:'maven'
apply plugin:'spring-boot'

依赖关系{
compile(org.springframework.boot:spring-boot-starter-web:1.1.6.RELEASE)
compile(group:'org.ihc.mh' ,name:'mh-util',版本:'13 .12.5'​​){
exclude(module:'slf4j-api')
exclude(module:'slf4j-log4j12')
}
testcompile(group:'org.springframework.boot',name:'spring-boot-starter-test',version:'1.1.6.RELEASE'){
exclude(module: 'commons-logging')
} * /
}

buildscript {
dependencies {
classpath(org.springframework.boot:spring-boot -gradle-plugin:1.1.6.RELEASE)
}
}

/ *
idea {
module {
inheritOutputDirs = false
outputDir = file($ buildDir / classes / main /)
}
} * /
code>

另外,如果我直接运行Initializer(作为Java可执行类),它运行良好。但是,当我将它打包为jar并运行jar文件时,这会失败。任何帮助/见解都会受到赞赏。



Gradle和Maven依赖库文件夹之间的差异

 仅在Gradle构建中:commons-logging-1.1.3.jar 
仅在Gradle构建中:jackson-annotations-2.3.0.jar
仅在Gradle构建中:spring-boot-starter -security-1.1.6.RELEASE.jar
只有在Gradle Build中:spring-context-support-3.0.5.RELEASE.jar
只有在Gradle Build中:spring-jdbc-3.0.5.RELEASE .jar
只有在Gradle Build中:spring-security-config-3.2.5.RELEASE.jar
只有在Gradle Build中:spring-security-core-3.2.5.RELEASE.jar
只有在Gradle中:spring-security-web-3.2.5.RELEASE.jar
只有在Gradle Build中:spring-tx-3.0.5.RELEASE.jar


仅在Maven中构建:jackson-annotations-2.3.4.jar
仅在Maven中构建:spring-context-support-4.0.7.RELEASE.jar
仅在Maven中构建:spring-jdbc-4.0 .7.RELEASE.jar
仅在Maven Build中:spring-tx-4.0.7.RELEASE.jar


解决方案

我尝试使用上面的代码段重新创建您的失败,但无法做到这一点。正如你有与Maven一起工作的那样,试着看看 unzip -l 的输出对Maven和Gradle构建的jar的运行情况,看看你能否发现缺少的内容Gradle案例。


Update: Weirdly, this error is thrown only when I build the jar with Gradle. The Maven generated jar runs fine! So I'm currently exploring if and how my gradle build script/spring boot config is failing.

I have a spring boot app throwing the following error

 =========================
    AUTO-CONFIGURATION REPORT
    =========================

    Positive matches:
    -----------------

       DataSourceAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType (OnClassCondition)

       DataSourceAutoConfiguration.DataSourceInitializerConfiguration
          - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer; SearchStrategy: all) found no beans (OnBeanCondition)

       DataSourceTransactionManagerAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionManager (OnClassCondition)

       DataSourceTransactionManagerAutoConfiguration.TransactionManagementConfiguration
          - @ConditionalOnMissingBean (types: org.springframework.transaction.annotation.AbstractTransactionManagementConfiguration; SearchStrategy: all) found no beans (OnBeanCondition)

       DispatcherServletAutoConfiguration
          - found web application StandardServletEnvironment (OnWebApplicationCondition)
          - @ConditionalOnClass classes found: org.springframework.web.servlet.DispatcherServlet (OnClassCondition)

       DispatcherServletAutoConfiguration.DispatcherServletConfiguration
          - no ServletRegistrationBean found (DispatcherServletAutoConfiguration.DefaultDispatcherServletCondition)
          - @ConditionalOnClass classes found: javax.servlet.ServletRegistration (OnClassCondition)

       EmbeddedServletContainerAutoConfiguration
          - found web application StandardServletEnvironment (OnWebApplicationCondition)

       EmbeddedServletContainerAutoConfiguration.EmbeddedTomcat
          - @ConditionalOnClass classes found: javax.servlet.Servlet,org.apache.catalina.startup.Tomcat (OnClassCondition)
          - @ConditionalOnMissingBean (types: org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; SearchStrategy: current) found no beans (OnBeanCondition)

       ErrorMvcAutoConfiguration
          - @ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet (OnClassCondition)
          - found web application StandardServletEnvironment (OnWebApplicationCondition)

       ErrorMvcAutoConfiguration#basicErrorController
          - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.ErrorController; SearchStrategy: current) found no beans (OnBeanCondition)

       ErrorMvcAutoConfiguration#errorAttributes
          - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.ErrorAttributes; SearchStrategy: current) found no beans (OnBeanCondition)

       ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration
          - No error template view detected (ErrorMvcAutoConfiguration.ErrorTemplateMissingCondition)
          - SpEL expression on org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration: ${error.whitelabel.enabled:true} (OnExpressionCondition)

       ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration#beanNameViewResolver
          - @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.BeanNameViewResolver; SearchStrategy: all) found no beans (OnBeanCondition)

       ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration#defaultErrorView
          - @ConditionalOnMissingBean (names: error; SearchStrategy: all) found no beans (OnBeanCondition)

       HttpMessageConvertersAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.http.converter.HttpMessageConverter (OnClassCondition)

       HttpMessageConvertersAutoConfiguration#messageConverters
          - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.HttpMessageConverters; SearchStrategy: all) found no beans (OnBeanCondition)

       HttpMessageConvertersAutoConfiguration.ObjectMappers
          - @ConditionalOnClass classes found: com.fasterxml.jackson.databind.ObjectMapper (OnClassCondition)

       HttpMessageConvertersAutoConfiguration.ObjectMappers#mappingJackson2HttpMessageConverter
          - @ConditionalOnMissingBean (types: org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; SearchStrategy: all) found no beans (OnBeanCondition)

       JacksonAutoConfiguration
          - @ConditionalOnClass classes found: com.fasterxml.jackson.databind.ObjectMapper (OnClassCondition)

       JacksonAutoConfiguration.JacksonObjectMapperAutoConfiguration
          - @ConditionalOnClass classes found: com.fasterxml.jackson.databind.ObjectMapper (OnClassCondition)

       JmxAutoConfiguration
          - @ConditionalOnClass classes found: org.springframework.jmx.export.MBeanExporter (OnClassCondition)
          - SpEL expression on org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration: ${spring.jmx.enabled:true} (OnExpressionCondition)

       JmxAutoConfiguration#mbeanServer
          - @ConditionalOnMissingBean (types: javax.management.MBeanServer; SearchStrategy: all) found no beans (OnBeanCondition)

       MultipartAutoConfiguration
          - @ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.multipart.support.StandardServletMultipartResolver,javax.servlet.MultipartConfigElement (OnClassCondition)
          - SpEL expression on org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration: ${multipart.enabled:true} (OnExpressionCondition)

       MultipartAutoConfiguration#multipartConfigElement
          - @ConditionalOnMissingBean (types: javax.servlet.MultipartConfigElement; SearchStrategy: all) found no beans (OnBeanCondition)

       MultipartAutoConfiguration#multipartResolver
          - @ConditionalOnMissingBean (types: org.springframework.web.multipart.support.StandardServletMultipartResolver; SearchStrategy: all) found no beans (OnBeanCondition)

       ServerPropertiesAutoConfiguration
          - found web application StandardServletEnvironment (OnWebApplicationCondition)

       ServerPropertiesAutoConfiguration#serverProperties
          - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.ServerProperties; SearchStrategy: current) found no beans (OnBeanCondition)

       WebMvcAutoConfiguration
          - found web application StandardServletEnvironment (OnWebApplicationCondition)
          - @ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet,org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter (OnClassCondition)
          - @ConditionalOnMissingBean (types: org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; SearchStrategy: all) found no beans (OnBeanCondition)

       WebMvcAutoConfiguration#hiddenHttpMethodFilter
          - @ConditionalOnMissingBean (types: org.springframework.web.filter.HiddenHttpMethodFilter; SearchStrategy: all) found no beans (OnBeanCondition)

       WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver
          - @ConditionalOnBean (types: org.springframework.web.servlet.View; SearchStrategy: all) found the following [error] (OnBeanCondition)

       WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#defaultViewResolver
          - @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.InternalResourceViewResolver; SearchStrategy: all) found no beans (OnBeanCondition)

       WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#requestContextListener
          - @ConditionalOnMissingBean (types: org.springframework.web.context.request.RequestContextListener; SearchStrategy: all) found no beans (OnBeanCondition)

       WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#viewResolver
          - @ConditionalOnBean (types: org.springframework.web.servlet.ViewResolver; SearchStrategy: all) found the following [beanNameViewResolver, defaultViewResolver] @ConditionalOnMissingBean (names: viewResolver; SearchStrategy: all) found no beans (OnBeanCondition)


    Negative matches:
    -----------------

      ....
....
       WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#dateFormatter
          - @ConditionalOnProperty missing required properties: date-format not found (OnPropertyCondition)

       WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#localeResolver
          - @ConditionalOnMissingBean (types: org.springframework.web.servlet.LocaleResolver; SearchStrategy: all) found no beans (OnBeanCondition)
          - @ConditionalOnProperty missing required properties: locale not found (OnPropertyCondition)

       WebSocketAutoConfiguration
          - required @ConditionalOnClass classes not found: org.springframework.web.socket.WebSocketHandler,org.apache.tomcat.websocket.server.WsSci (OnClassCondition)



    15:11:13.684 [main] ERROR o.s.boot.SpringApplication - Application startup failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762) ~[spring-context-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) ~[spring-context-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) ~[spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:952) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    Disconnected from the target VM, address: '127.0.0.1:61052', transport: 'socket'
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:941) [spring-boot-1.1.6.RELEASE.jar:1.1.6.RELEASE]
        at org.ihc.phr.status.Initializer.main(Initializer.java:17) [main/:na]
    Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
        at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_20]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
        at org.ihc.phr.status.Initializer.main(Initializer.java:17)
    Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
        at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
        at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
        at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_20]
        at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_20]
        at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
        at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_20]
        at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_20]
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_20]
        at java.lang.Class.createAnnotationData(Class.java:3508)
        at java.lang.Class.createAnnotationData(Class.java:3508) ~[na:1.8.0_20]
        at java.lang.Class.annotationData(Class.java:3497)
        at java.lang.Class.createAnnotationData(Class.java:3513)
        at java.lang.Class.annotationData(Class.java:3497)
        at java.lang.Class.getDeclaredAnnotations(Class.java:3464)
        at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:352)
        at java.lang.Class.annotationData(Class.java:3497) ~[na:1.8.0_20]
        at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:319)
        at java.lang.Class.createAnnotationData(Class.java:3513) ~[na:1.8.0_20]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:173)
        at java.lang.Class.annotationData(Class.java:3497) ~[na:1.8.0_20]
        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:123)
        at java.lang.Class.getDeclaredAnnotations(Class.java:3464) ~[na:1.8.0_20]
        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
        at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:352) ~[spring-core-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
        ... 15 more
        at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:319) ~[spring-core-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:173) ~[spring-webmvc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:123) ~[spring-webmvc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103) ~[spring-webmvc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126) ~[spring-webmvc-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) ~[spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        ... 15 common frames omitted
    :bootRun FAILED

    FAILURE: Build failed with an exception.

Initializer:

@Configuration
@ComponentScan(basePackages={"com.mycompany",
"com.mycompany.utils",
"com.mycompany.domain","com.mycompany.resources",
 "com.mycompany.resources.hook"})
@EnableAutoConfiguration
public class Initializer {

    public static void main(String[] args) {
        SpringApplication.run(Initializer.class, args);
    }


}

Config class

@Configuration
@EnableAsync
@EnableScheduling
@PropertySource("classpath:application-dev.properties")
@ImportResource(value="classpath:applicationContext.xml")
@ComponentScan(basePackages={
        "com.mycompany.web"})
public class StatusConfiguration {
    @Autowired
    Environment env;

    @Bean
    public ObjectMapper jacksonObjectMapper() {
        return new CustomObjectMapper();
    }

    @Bean
    public TargetServer targetServer(){
        TargetServer targetServer = new TargetServer();
        targetServer.setJndiValidationConnectionURL(env.getProperty("jndiValidationConnectionURL"));
        targetServer.setJndiValidationUsername(env.getProperty("jndiValidationUsername"));
        targetServer.setJndiValidationPassword(env.getProperty("jndiValidationPassword"));
        return targetServer;
    }
}

Controller

@RestController
public class StatusController {

    @Autowired
    private ReportService reportService;

    @Autowired
    private TargetServer targetServer;

    private Logger log = LoggerFactory.getLogger(StatusController.class);

     @RequestMapping(value = "/report")

        public MyReport getStatus(){
        MyReport report = reportService.getReport();
        return report;
    }

    @RequestMapping(value = "/report/no-cache")
    public MyReport getStatusNoCache(){
        autoRunReport();
        MyReport report = reportService.getReport();
        return report;
    }


    @Scheduled(fixedDelay=300000)
    public void autoRunReport(){
        reportService.kickOffReport(targetServer);
        log.debug("Running the scheduled validation Report!");
    }

}

Gradle config

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'spring-boot'

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web:1.1.6.RELEASE")
    compile(group: 'org.ihc.mh', name: 'mh-util', version:'13.12.5') {
exclude(module: 'slf4j-api')
exclude(module: 'slf4j-log4j12')
    }
   /* testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test', version:'1.1.6.RELEASE') {
exclude(module: 'commons-logging')
    }*/
}

buildscript {
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE")
    }
}

/*
idea {
    module {
        inheritOutputDirs = false
        outputDir = file("$buildDir/classes/main/")
    }
}*/

Also if I run the Initializer directly (as a Java executable class), it runs fine. However this fails when I package it as a jar and then run the jar file. Any help/insights are appreciated.

Diff between Gradle and Maven dependency lib folders

Only in Gradle Build: commons-logging-1.1.3.jar
Only in Gradle Build: jackson-annotations-2.3.0.jar
Only in Gradle Build: spring-boot-starter-security-1.1.6.RELEASE.jar
Only in Gradle Build: spring-context-support-3.0.5.RELEASE.jar
Only in Gradle Build: spring-jdbc-3.0.5.RELEASE.jar
Only in Gradle Build: spring-security-config-3.2.5.RELEASE.jar
Only in Gradle Build: spring-security-core-3.2.5.RELEASE.jar
Only in Gradle Build: spring-security-web-3.2.5.RELEASE.jar
Only in Gradle Build: spring-tx-3.0.5.RELEASE.jar


Only in Maven Build: jackson-annotations-2.3.4.jar
Only in Maven Build: spring-context-support-4.0.7.RELEASE.jar
Only in Maven Build: spring-jdbc-4.0.7.RELEASE.jar
Only in Maven Build: spring-tx-4.0.7.RELEASE.jar
解决方案

We (the Spring Boot team) have seen this sort of problem a few times before. Unfortunately, the JVM's diagnostics are really poor. What it's trying to tell you is that it's encountered an annotation with a Class[] attribute that's referencing a class that isn't on the classpath. It would be hugely helpful if it told you what the missing class was...

I've tried to recreate your failure using the snippets above but was unable to do so. As you have this working with Maven, try taking a look at the output from unzip -l run against the jars built with Maven and Gradle and see if you can spot what's missing in the Gradle case.

这篇关于Spring引导requestMappingHandlerMapping java.lang.ArrayStoreException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 02:21