Spring Boot上的启动错误

时间:2015-08-15 17:45:58

标签: spring maven spring-boot spring-data-rest

我花了很多时间但是没有使用maven这个例子: https://github.com/juleswhite/mobilecloud-14/tree/master/examples/6-VideoServiceWithDataRest 如果配置是jetty,为什么Spring Boot启动了tomcat?

下面是pom.xml的内容:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.springframework</groupId>
    <artifactId>gs-spring-boot</artifactId>
    <version>0.1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.5.RELEASE</version>
    </parent>


    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>    
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>       
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>       
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-rest-webmvc</artifactId>
            <version>2.1.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>17.0</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.retrofit</groupId>
            <artifactId>retrofit</artifactId>
            <version>1.9.0</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.36</version>
        </dependency>

    </dependencies>

    <properties>
        <java.version>1.7</java.version>
    </properties>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>
</project>

这里输出:

[INFO] Scanning for projects...
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building gs-spring-boot 0.1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:1.2.5.RELEASE:run (default-cli) @ gs-spring-boot >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gs-spring-boot ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ gs-spring-boot ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ gs-spring-boot ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Murillo\Documents\workspace\SpringBootTest\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ gs-spring-boot ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< spring-boot-maven-plugin:1.2.5.RELEASE:run (default-cli) @ gs-spring-boot <<<
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.2.5.RELEASE:run (default-cli) @ gs-spring-boot ---

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.2.5.RELEASE)

2015-08-13 00:10:11.310  INFO 6252 --- [lication.main()] hello.Application                        : Starting Application on MURILLO-ULTRA with PID 6252 (C:\Users\Murillo\Documents\workspace\SpringBootTest\target\classes started by Murillo in C:\Users\Murillo\Documents\workspace\SpringBootTest)
2015-08-13 00:10:11.419  INFO 6252 --- [lication.main()] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7519761c: startup date [Thu Aug 13 00:10:11 BRT 2015]; root of context hierarchy
2015-08-13 00:10:14.900  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8f1d65e9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:14.940  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:14.971  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:14.971  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.096  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'defaultRelProvider' of type [class org.springframework.hateoas.core.EvoInflectorRelProvider] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.096  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'annotationRelProvider' of type [class org.springframework.hateoas.core.AnnotationRelProvider] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.112  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#7ac7c9cc' of type [class org.springframework.plugin.core.support.PluginRegistryFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.127  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#7ac7c9cc' of type [class org.springframework.plugin.core.OrderAwarePluginRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.143  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean '_relProvider' of type [class org.springframework.hateoas.core.DelegatingRelProvider] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.174  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.data.web.config.SpringDataJacksonConfiguration' of type [class org.springframework.data.web.config.SpringDataJacksonConfiguration$$EnhancerBySpringCGLIB$$bc91ef3d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.206  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'jacksonGeoModule' of type [class org.springframework.data.geo.GeoModule] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.206  INFO 6252 --- [lication.main()] trationDelegate$BeanPostProcessorChecker : Bean 'application' of type [class hello.Application$$EnhancerBySpringCGLIB$$519bac2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-13 00:10:15.862  INFO 6252 --- [lication.main()] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2015-08-13 00:10:16.245  INFO 6252 --- [lication.main()] o.apache.catalina.core.StandardService   : Starting service Tomcat
2015-08-13 00:10:16.257  INFO 6252 --- [lication.main()] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.0.23
2015-08-13 00:10:16.382  INFO 6252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2015-08-13 00:10:16.382  INFO 6252 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4963 ms
2015-08-13 00:10:16.991  INFO 6252 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2015-08-13 00:10:17.007  INFO 6252 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'metricFilter' to: [/*]
2015-08-13 00:10:17.007  INFO 6252 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
2015-08-13 00:10:17.007  INFO 6252 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2015-08-13 00:10:17.007  INFO 6252 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'applicationContextIdFilter' to: [/*]
2015-08-13 00:10:17.788  INFO 6252 --- [lication.main()] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2015-08-13 00:10:17.814  INFO 6252 --- [lication.main()] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2015-08-13 00:10:17.923  INFO 6252 --- [lication.main()] org.hibernate.Version                    : HHH000412: Hibernate Core {4.3.10.Final}
2015-08-13 00:10:17.923  INFO 6252 --- [lication.main()] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2015-08-13 00:10:17.939  INFO 6252 --- [lication.main()] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2015-08-13 00:10:18.157  INFO 6252 --- [lication.main()] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2015-08-13 00:10:18.595  INFO 6252 --- [lication.main()] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2015-08-13 00:10:18.767  INFO 6252 --- [lication.main()] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
2015-08-13 00:10:19.173  INFO 6252 --- [lication.main()] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000228: Running hbm2ddl schema update
2015-08-13 00:10:19.173  INFO 6252 --- [lication.main()] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000102: Fetching database metadata
2015-08-13 00:10:19.185  INFO 6252 --- [lication.main()] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000396: Updating schema
2015-08-13 00:10:19.216  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000261: Table found: smart.grupo_leitos
2015-08-13 00:10:19.216  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000037: Columns: [id, leitos_ocupados, data_hora_envio, leitos_totais, hospital]
2015-08-13 00:10:19.216  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000108: Foreign keys: []
2015-08-13 00:10:19.216  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000126: Indexes: [primary]
2015-08-13 00:10:19.232  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000261: Table found: smart.tag
2015-08-13 00:10:19.232  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000037: Columns: [id, name, type]
2015-08-13 00:10:19.232  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000108: Foreign keys: []
2015-08-13 00:10:19.232  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000126: Indexes: [primary]
2015-08-13 00:10:19.248  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000261: Table found: smart.video
2015-08-13 00:10:19.248  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000037: Columns: [id, duration, name, url]
2015-08-13 00:10:19.248  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000108: Foreign keys: []
2015-08-13 00:10:19.248  INFO 6252 --- [lication.main()] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000126: Indexes: [primary]
2015-08-13 00:10:19.248  INFO 6252 --- [lication.main()] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000232: Schema update complete
2015-08-13 00:10:19.873  WARN 6252 --- [lication.main()] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'repositoryEntityController' defined in URL [jar:file:/C:/Users/Murillo/.m2/repository/org/springframework/data/spring-data-rest-webmvc/2.1.0.RELEASE/spring-data-rest-webmvc-2.1.0.RELEASE.jar!/org/springframework/data/rest/webmvc/RepositoryEntityController.class]: Unsatisfied dependency expressed through constructor argument with index 1 of type [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: : Error creating bean with name 'config' defined in hello.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.data.rest.core.config.RepositoryRestConfiguration.<init>(Lorg/springframework/data/rest/core/config/ProjectionDefinitionConfiguration;)V; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in hello.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.data.rest.core.config.RepositoryRestConfiguration.<init>(Lorg/springframework/data/rest/core/config/ProjectionDefinitionConfiguration;)V
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:185)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1139)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
    at hello.Application.main(Application.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418)
    at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in hello.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.data.rest.core.config.RepositoryRestConfiguration.<init>(Lorg/springframework/data/rest/core/config/ProjectionDefinitionConfiguration;)V
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
    ... 24 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.data.rest.core.config.RepositoryRestConfiguration.<init>(Lorg/springframework/data/rest/core/config/ProjectionDefinitionConfiguration;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 37 common frames omitted
Caused by: java.lang.NoSuchMethodError: org.springframework.data.rest.core.config.RepositoryRestConfiguration.<init>(Lorg/springframework/data/rest/core/config/ProjectionDefinitionConfiguration;)V
    at org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.config(RepositoryRestMvcConfiguration.java:239)
    at hello.Application$$EnhancerBySpringCGLIB$$519bac2.CGLIB$config$20(<generated>)
    at hello.Application$$EnhancerBySpringCGLIB$$519bac2$$FastClassBySpringCGLIB$$44df8206.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
    at hello.Application$$EnhancerBySpringCGLIB$$519bac2.config(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 38 common frames omitted

2 个答案:

答案 0 :(得分:2)

作为described in the documentation,添加对Jetty的依赖是不够的。您还需要排除Tomcat:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

您还需要删除spring-data-rest-webmvc依赖项上的版本。这将允许Spring Boot的依赖关系管理提供它所需的版本。

答案 1 :(得分:0)

将@ComponentScan basePack添加到您的启动它将起作用

minimumCoverage