Spring Boot auto configuration for datasource

后端 未结 2 1995
春和景丽
春和景丽 2020-12-09 15:13

I try to create Spring Boot app with Hibernate 5 and Postgres 9. Now I have next error:

Parameter 0 of constructor in org.springframework.boot.autoconfigure         


        
2条回答
  •  鱼传尺愫
    2020-12-09 15:58

    You're missing several classes (mostly pool related) on your classpath. The easiest solution is to use the Spring boot starter for JPA, which is:

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

    If you do this, you can remove the following dependencies since they're all part of the starter:

    
        org.springframework
        spring-context
        ${spring.version}
    
    
        org.springframework
        spring-tx
        ${spring.version}
    
    
        org.springframework
        spring-orm
        ${spring.version}
    
    
        org.springframework.data
        spring-data-jpa
        ${spring.data.version}
    
    
    
        org.hibernate
        hibernate-core
        ${hibernate.version}
    
    

    The alternative solution is to manually add a pool provider to your classpath, the default of spring-boot-starter-data-jpa is tomcat-jdbc (Hikari for Spring boot 2.x) but you can use any connection pool provider you want that is listed in the documentation.

提交回复
热议问题