当前位置: 首页 > 知识库问答 >
问题:

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

寿卜鹰
2023-03-14

我们刚刚开始一个新项目,正在研究Spring启动来启动我们的开发。Spring启动看起来很强大,但是有些魔法正在发生,我们还不明白。

我已经克隆了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:springwebmvc”

当运行gradle引导运行应用程序启动

然而,这也会触发很多我真的不想要的额外设置

这是使用Maven的Spring Boot示例的日志

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构建的日志,包括SpringWebMVC依赖项

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映射到[/]映射过滤器:'hiddenHttpMultiodFilter'到:[/*]

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]

我不确定为什么我需要包括sping-webmvc依赖,以便在使用gradle时实际启动服务器,而不是使用Maven?我想在继续Spring启动之前解决这个问题,这样我们就不会在稍后遇到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"
    }

来自简化构建的依赖项*

~/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个答案

齐阎宝
2023-03-14

您在Spring Boot中发现了一个bug。谢谢你帮我找到它。正如bug报告中提到的,您可以通过排除Groovy模板的自动配置来解决此问题:

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

    // …
}
 类似资料:
  • 从文件夹内部执行“npm start”命令时出现以下错误/ 我在互联网上尝试了多种解决方案,但都无效。

  • 我尝试使用mockmvc,但它总是显示错误: 原因:org.springframework.beans.factory.NoSuchBeanDefinitionException:没有可用的“org.springframework.test.web.servlet.MockMvc”类型的合格bean:预计至少有1个bean符合自动装配候选资格。依赖注释:{@org.springframework.

  • 我试图用Gradle在IPhone模拟器上运行一个基本的Hello World libgdx应用程序。我是gradle和Robovm的新手。 首先,我应该指出,我能够成功构建和运行tis示例应用程序https://github.com/jtakakura/robovm-sample-ios-app,使用以下命令: 我认为LaunchiphoneImulator任务依赖于构建任务,调用Lanuchi

  • 我将项目从转换为。 在启动tomcat服务器时进行转换后,我将获得以下错误日志。 Catalina启动严重:必需的服务器组件启动失败,因此Tomcat无法启动。org.apache.Catalina.LifeCycleException:无法启动组件[StandardServer[8005]](位于org.apache.Catalina.util.LifeCycleBase.start(LifeC

  • 我开发了一套关于实体的保存、搜索和修改的Spock测试,一切都运行得很顺利。具体地说,我有一个Spring Boot应用程序冒烟测试,以确保配置正确加载 由于自然密钥是channel和service,所以我尝试定义了一个复合密钥 以及主键类(节选) 构建jar并运行测试,然后 启动Spring Boot服务器

  • 我得到了这个错误,当我试图使用比特桶构建状态通知插件(https://wiki.jenkins.io/display/JENKINS/Bitbucket云构建状态通知插件)在Jenkins CI.我遵循了这个教程:https://www.youtube.com/watch?v=uu5XcU4EPzQ但我不知道问题出在哪里。