SpringCloud 添加spring-boot-starter-data-jpa后报错

小白 学习微服务当中

之前能够运行,后来不知道怎么了报错

重新构建项目后 还是一引入这个就报错 不知道是哪里配置出了问题 但是之前并没有报错

connnected to the target VM, address: '127.0.0.1:1736', transport: 'socket'

2018-07-18 20:47:24.545  INFO 19252 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@421bba99: startup date [Wed Jul 18 20:47:24 CST 2018]; root of context hierarchy
2018-07-18 20:47:24.789  INFO 19252 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-07-18 20:47:24.803  INFO 19252 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$5deff870] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::  (v2.1.0.BUILD-SNAPSHOT)

2018-07-18 20:47:25.322  INFO 19252 --- [  main] com.he.product.ProductApplication        : No active profile set, falling back to default profiles: default


2018-07-18 20:47:25.336  INFO 19252 --- [ main] ConfigServletWebServerApplicationContext :

Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@680362a: startupdate[WedJul1820:47:25CST2018];parent:org.springframework.context.annotation.AnnotationConfigApplicationContext@421bba99
2018-07-18 20:47:26.113  WARN 19252 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException:

 

Invalid bean definition with name 'dataSource' defined in BeanDefinition defined in class path resource

 

[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Cannot register bean definition [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]]

for bean 'dataSource': There is already [Root bean: class [null]; scope=refresh; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] bound.
2018-07-18 20:47:26.125  INFO 19252 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-18 20:47:26.135 ERROR 19252 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'dataSource', defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

Disconnected from the target VM, address: '127.0.0.1:1736', transport: 'socket'

Process finished with exit code 1

这是YML:

spring:
  application:
    name:  product
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123
    url: jdbc:mysql://Localhost:3306/SpringCloud_Sell?charaterEncoding=utf-8&useSSL=false
  jpa:
    show-sql: true
    database-platform: org.hibernate.dialect.MySQL5Dialect
eureka:
  client:
    service-url:
       defaultZone:  http://localhost:8761/eureka/
server:
  port: 8090

xml:



   4.0.0

   com.he
   product
   0.0.1-SNAPSHOT
   jar

   product
   Demo project for Spring Boot

   
      org.springframework.boot
      spring-boot-starter-parent
      2.1.0.BUILD-SNAPSHOT
       
   

   
      UTF-8
      UTF-8
      1.8
      Finchley.BUILD-SNAPSHOT
   

   
      
         org.springframework.cloud
         spring-cloud-starter-netflix-eureka-client
      

      
         org.springframework.boot
         spring-boot-starter-test
         test
      

        
            org.springframework.boot
            spring-boot-starter-data-jpa
        

        
            mysql
            mysql-connector-java
        

        
            org.springframework.boot
            spring-boot-starter-web
        

        
            org.projectlombok
            lombok
        

   

   
      
         
            org.springframework.cloud
            spring-cloud-dependencies
            ${spring-cloud.version}
            pom
            import
         
      
   

   
      
         
            org.springframework.boot
            spring-boot-maven-plugin
         
      
   

   
      
         spring-snapshots
         Spring Snapshots
         https://repo.spring.io/snapshot
         
            true
         
      
      
         spring-milestones
         Spring Milestones
         https://repo.spring.io/milestone
         
            false
         
      
   

   
      
         spring-snapshots
         Spring Snapshots
         https://repo.spring.io/snapshot
         
            true
         
      
      
         spring-milestones
         Spring Milestones
         https://repo.spring.io/milestone
         
            false
         
      
   



你可能感兴趣的:(SpringCloud 添加spring-boot-starter-data-jpa后报错)