启动时带有groovy / gradle的Spring boot Jersey失败

时间:2014-10-29 09:05:40

标签: gradle spring-boot jersey-2.0

我们刚刚开始一个新项目,并且正在研究spring-boot以启动我们的开发。 spring-boot看起来很强大,但还有一些魔法,我们还不明白。

我克隆了弹簧靴样本并运行了Jersey示例。 到现在为止还挺好。

然后我将其转换为Groovy / Gradle。

构建脚本的相关部分如下所示

.
.
buildscript {
    repositories {
        jcenter()
//        maven { url "http://repo.spring.io/snapshot" }
        maven { url "http://repo.spring.io/milestone" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.0.M2")
        classpath 'org.springframework:springloaded:1.2.0.RELEASE'
    }
}
.
.
apply plugin: 'spring-boot'
.
.
dependencies {
    compile project(':domain')
    compile "org.springframework.boot:spring-boot-starter-jersey",
            "org.glassfish.jersey.media:jersey-media-moxy:2.13"
}

运行gradle bootRun时,应用程序无法启动

例外是

    org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:51)
        2014-10-29 09:38:01.982 ERROR 17977 --- [           main] o.s.boot.SpringApplication               : Application startup failed
            at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)

            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:177)
        java.lang.IllegalStateException: Could not evaluate condition owing to internal class not found. This c at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:146)
        an happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:122)
            at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:51)
            at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:318)
            at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
            at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:177)
            at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:146)
            at .
    .
    .
    .
        pplicationBuilder.java:143)
        Caused by: java.lang.NoClassDefFoundError: org/springframework/web/serv at org.springframework.boot.builder.SpringApplicationBuilder$run.call(Unknown Source)
        let/view/UrlBasedViewResolver
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
            at geit.ApiApplication.main(ApiApplication.groovy:28)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/view/UrlBasedViewResolver
            at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
            at java.security.AccessController.doPrivileged(Native Method)
..
.
.       org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:145)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:571)
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:490)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:474)
            at java.lang.Class.getDeclaredMethods(Class.java:1855)
            at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:534)
            at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:145)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:678)
            at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:571)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:490)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:592)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:474)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1394)
            at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:534)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeaat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireC                                                                                                                                                      mesForType(DefaultListableBeanFactory.java:404)
        apableBeanFactory.java:678)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:373)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:165)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:592)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:153)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1394)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:122)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:404)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:96)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:373)
            at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:165)
            ... 19 more
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:153)
        Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.view.UrlBasedViewResolver
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:122)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:96)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45)
            at java.security.AccessController.doPrivileged(Native Method)
            ... 19 common frames omitted
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.view.UrlBasedViewResolver
            at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            at java.security.AccessController.doPrivileged(Native Method)
            ... 50 more 
        2014-10-29 09:38:01.983  INFO 17977 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@76e68f                                                                                                                                                            59: startup date [Wed Oct 29 
        FAILURE: Build failed with an exception.

要解决此ClassNotFoundException,我添加以下依赖项 “org.springframework:弹簧webmvc”

运行gradle bootRun时,应用程序启动

但是,这也会引发很多我真正不想要的额外设置

这是使用Maven的spring-boot-samples的日志

2014-10-29 09:43:01.466  INFO 18089 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1414 ms
2014-10-29 09:43:01.612  INFO 18089 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'jerseyServlet' to [/*]
2014-10-29 09:43:01.614  INFO 18089 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
2014-10-29 09:43:02.071  INFO 18089 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2014-10-29 09:43:02.081  INFO 18089 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Initializing ProtocolHandler ["http-nio-8080"]
2014-10-29 09:43:02.089  INFO 18089 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Starting ProtocolHandler ["http-nio-8080"]
2014-10-29 09:43:02.096  INFO 18089 --- [           main] o.a.tomcat.util.net.NioSelectorPool      : Using a shared selector for servlet write/read
2014-10-29 09:43:02.109  INFO 18089 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2014-10-29 09:43:02.111  INFO 18089 --- [           main] sample.jersey.SampleJerseyApplication    : Started SampleJerseyApplication in 2.456 seconds (JVM running for 2.792)

这是我的gradle构建的日志,包括spring-webmvc依赖

2014-10-29 09:42:20.276  INFO 18078 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2014-10-29 09:42:20.277  INFO 18078 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5680 ms
2014-10-29 09:42:20.881  INFO 18078 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'jerseyServlet' to [/*]
2014-10-29 09:42:20.883  INFO 18078 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2014-10-29 09:42:20.884  INFO 18078 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
2014-10-29 09:42:20.885  INFO 18078 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2014-10-29 09:42:21.204  INFO 18078 --- [           main] o.s.b.f.xml.XmlBeanDefinitionReader      : Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
2014-10-29 09:42:21.239  INFO 18078 --- [           main] o.s.jdbc.support.SQLErrorCodesFactory    : SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
2014-10-29 09:42:21.510  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.649  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3450feef: startup date [Wed Oct 29 09:42:14 CET 2014]; root of context hierarchy
2014-10-29 09:42:22.064  INFO 18078 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2014-10-29 09:42:22.115  INFO 18078 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2014-10-29 09:42:22.118  INFO 18078 --- [           main] geit.ApiApplication                      : Started ApiApplication in 8.126 seconds (JVM running for 9.259)
> 2014-10-29 09:42:51.012  INFO 18078 --- [       Thread-2] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3450feef: startup date [Wed Oct 29 09:42:14 CET 2014]; root of context hierarchy

我们可以看到,以下内容现已自动注册

将servlet映射:'dispatcherServlet'到[/] 映射过滤器:'hiddenHttpMethodFilter'为:[/ *]

和spring-webmvc正在映射网址

2014-10-29 09:42:21.510  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

我不确定为什么我需要在使用gradle时包含spring-webmvc依赖项来实际启动服务器,而不是使用Maven? 我想在继续spring-boot之前解决这个问题,以便我们以后不会遇到springmvc / jersey冲突 这是一个错误吗? 由于用户错误?

任何帮助表示赞赏 :)

申请类

@ComponentScan
@EnableAutoConfiguration
class ApiApplication extends SpringBootServletInitializer {
//class ApiApplication {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ApiApplication);
    }

    static void main(String[] args) {
        new ApiApplication()
                .configure(new SpringApplicationBuilder(ApiApplication))
                .run(args);
//        SpringApplication.run ApiApplication, args
    }

}

简化构建脚本

我简化了构建脚本,没有多模块构建,只有spring-boot-jersey。 其余代码来自样本。它仍然失败。

buildscript {
        repositories {
            jcenter()
            maven { url "http://repo.spring.io/snapshot" }
            maven { url "http://repo.spring.io/milestone" }
        }
        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.0.BUILD-SNAPSHOT")
    //        classpath 'org.springframework:springloaded:1.2.0.RELEASE'
        }
    }

    repositories {
    //    jcenter()
        mavenLocal()
        mavenCentral()
        maven { url "http://repo.spring.io/snapshot" }
        maven { url "http://repo.spring.io/milestone" }
    }


    apply plugin: 'idea'
    apply plugin: 'java'
    //apply plugin: 'groovy'
    apply plugin: 'spring-boot'


    version = '0.1-SNAPSHOT'


    jar {
        baseName = 'jersey-test'
    }

    dependencies {
        compile "org.codehaus.groovy:groovy-all:2.3.7"
        compile "org.springframework.boot:spring-boot-starter-jersey",
                "org.glassfish.jersey.media:jersey-media-moxy:2.7"
        testCompile "org.springframework.boot:spring-boot-starter-test"
    }

simpleiefied build *

的依赖关系
~/Development/git-repos/geitkontroll/jersey-test (geit-32) $ gradle dependencies --configuration runtime
:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

runtime - Runtime classpath for source set 'main'.
+--- org.codehaus.groovy:groovy-all:2.3.7
+--- org.springframework.boot:spring-boot-starter-jersey: -> 1.2.0.M2
|    +--- org.springframework.boot:spring-boot-starter:1.2.0.M2
|    |    +--- org.springframework.boot:spring-boot:1.2.0.M2
|    |    |    +--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |    \--- org.springframework:spring-context:4.1.1.RELEASE
|    |    |         +--- org.springframework:spring-aop:4.1.1.RELEASE
|    |    |         |    +--- aopalliance:aopalliance:1.0
|    |    |         |    +--- org.springframework:spring-beans:4.1.1.RELEASE
|    |    |         |    |    \--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |         |    \--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |         +--- org.springframework:spring-beans:4.1.1.RELEASE (*)
|    |    |         +--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |         \--- org.springframework:spring-expression:4.1.1.RELEASE
|    |    |              \--- org.springframework:spring-core:4.1.1.RELEASE
|    |    +--- org.springframework.boot:spring-boot-autoconfigure:1.2.0.M2
|    |    |    \--- org.springframework.boot:spring-boot:1.2.0.M2 (*)
|    |    +--- org.springframework.boot:spring-boot-starter-logging:1.2.0.M2
|    |    |    +--- org.slf4j:jcl-over-slf4j:1.7.7
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.7
|    |    |    +--- org.slf4j:jul-to-slf4j:1.7.7
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.7
|    |    |    +--- org.slf4j:log4j-over-slf4j:1.7.7
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.7
|    |    |    \--- ch.qos.logback:logback-classic:1.1.2
|    |    |         +--- ch.qos.logback:logback-core:1.1.2
|    |    |         \--- org.slf4j:slf4j-api:1.7.6 -> 1.7.7
|    |    +--- org.springframework:spring-core:4.1.1.RELEASE
|    |    \--- org.yaml:snakeyaml:1.13
|    +--- org.springframework.boot:spring-boot-starter-tomcat:1.2.0.M2
|    |    +--- org.apache.tomcat.embed:tomcat-embed-core:7.0.55
|    |    +--- org.apache.tomcat.embed:tomcat-embed-el:7.0.55
|    |    \--- org.apache.tomcat.embed:tomcat-embed-logging-juli:7.0.55
|    +--- com.fasterxml.jackson.core:jackson-databind:2.4.2
|    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.4.0
|    |    \--- com.fasterxml.jackson.core:jackson-core:2.4.2
|    +--- org.hibernate:hibernate-validator:5.1.2.Final
|    |    +--- javax.validation:validation-api:1.1.0.Final
|    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA
|    |    \--- com.fasterxml:classmate:1.0.0
|    +--- org.springframework:spring-core:4.1.1.RELEASE
|    +--- org.springframework:spring-web:4.1.1.RELEASE
|    |    +--- org.springframework:spring-aop:4.1.1.RELEASE (*)
|    |    +--- org.springframework:spring-beans:4.1.1.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.1.1.RELEASE (*)
|    |    \--- org.springframework:spring-core:4.1.1.RELEASE
|    +--- org.glassfish.jersey.core:jersey-server:2.7
|    |    +--- org.glassfish.jersey.core:jersey-common:2.7
|    |    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    |    +--- javax.annotation:javax.annotation-api:1.2
|    |    |    +--- org.glassfish.jersey.bundles.repackaged:jersey-guava:2.7
|    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0
|    |    |    |    +--- javax.inject:javax.inject:1
|    |    |    |    +--- org.glassfish.hk2:hk2-utils:2.2.0
|    |    |    |    |    \--- javax.inject:javax.inject:1
|    |    |    |    \--- org.glassfish.hk2.external:aopalliance-repackaged:2.2.0
|    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    |    +--- org.glassfish.hk2:hk2-locator:2.2.0
|    |    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    |    |    +--- org.glassfish.hk2.external:aopalliance-repackaged:2.2.0
|    |    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|    |    |    |    +--- org.glassfish.hk2:hk2-utils:2.2.0 (*)
|    |    |    |    \--- org.javassist:javassist:3.18.1-GA
|    |    |    \--- org.glassfish.hk2:osgi-resource-locator:1.0.1
|    |    +--- org.glassfish.jersey.core:jersey-client:2.7
|    |    |    +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
|    |    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    |    \--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    +--- javax.annotation:javax.annotation-api:1.2
|    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    +--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|    |    \--- javax.validation:validation-api:1.1.0.Final
|    +--- org.glassfish.jersey.containers:jersey-container-servlet-core:2.7
|    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    +--- org.glassfish.jersey.core:jersey-server:2.7 (*)
|    |    +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
|    |    \--- javax.ws.rs:javax.ws.rs-api:2.0
|    +--- org.glassfish.jersey.containers:jersey-container-servlet:2.7
|    |    +--- org.glassfish.jersey.containers:jersey-container-servlet-core:2.7 (*)
|    |    +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
|    |    +--- org.glassfish.jersey.core:jersey-server:2.7 (*)
|    |    \--- javax.ws.rs:javax.ws.rs-api:2.0
|    \--- org.glassfish.jersey.ext:jersey-spring3:2.7
|         +--- org.glassfish.jersey.core:jersey-server:2.7 (*)
|         +--- org.glassfish.jersey.containers:jersey-container-servlet-core:2.7 (*)
|         +--- org.glassfish.hk2:hk2:2.2.0
|         |    +--- org.glassfish.hk2:hk2-utils:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|         |    +--- org.glassfish.hk2:config-types:2.2.0
|         |    |    \--- org.glassfish.hk2:hk2-config:2.2.0
|         |    |         +--- org.glassfish.hk2:core:2.2.0
|         |    |         |    +--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|         |    |         |    \--- org.glassfish.hk2:hk2-utils:2.2.0 (*)
|         |    |         +--- org.jvnet:tiger-types:1.4
|         |    |         \--- org.glassfish.hk2.external:bean-validator:2.2.0
|         |    +--- org.glassfish.hk2:core:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-config:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-runlevel:2.2.0
|         |    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|         |    |    \--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|         |    \--- org.glassfish.hk2:class-model:2.2.0
|         |         \--- junit:junit:4.3.1
|         +--- org.glassfish.hk2:spring-bridge:2.2.0
|         |    \--- org.springframework:spring-context:3.2.3.RELEASE -> 4.1.1.RELEASE (*)
|         +--- org.springframework:spring-beans:3.2.3.RELEASE -> 4.1.1.RELEASE (*)
|         +--- org.springframework:spring-core:3.2.3.RELEASE -> 4.1.1.RELEASE
|         +--- org.springframework:spring-web:3.2.3.RELEASE -> 4.1.1.RELEASE (*)
|         \--- javax.ws.rs:javax.ws.rs-api:2.0
\--- org.glassfish.jersey.media:jersey-media-moxy:2.7
     +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
     +--- org.glassfish.jersey.ext:jersey-entity-filtering:2.7
     |    \--- javax.ws.rs:javax.ws.rs-api:2.0
     +--- org.eclipse.persistence:org.eclipse.persistence.moxy:2.5.0
     |    +--- org.eclipse.persistence:org.eclipse.persistence.core:2.5.0
     |    |    \--- org.eclipse.persistence:org.eclipse.persistence.asm:2.5.0
     |    \--- org.eclipse.persistence:org.eclipse.persistence.antlr:2.5.0
     \--- org.eclipse.persistence:org.eclipse.persistence.antlr:2.5.0

(*) - dependencies omitted (listed previously)

1 个答案:

答案 0 :(得分:0)

您找到了bug in Spring Boot。感谢您帮助追踪它。如错误报告中所述,您可以通过排除Groovy模板的自动配置来解决此问题:

@ComponentScan
@EnableAutoConfiguration(exclude=GroovyTemplateAutoConfiguration.class)
class ApiApplication extends SpringBootServletInitializer {

    // …
}