spring jpa data笔记

tomcat启动Maven项目的时候总抛出这样的错误:java

Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed;spring

看了一下错误的最后一句是数据库

Cannot determine embedded database driver class for database type NONEtomcat

找到一个国外问相似问题的,有一我的给出的答案是在pom.xml里加上依赖spring-boot

 <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.3.156</version> </dependency>

下面有人问你肯定你要在咱们讨论GAE/Datastore的时候乱入H2 database?一我的跟进说他成功了,又有一我的说他也成功了。因而我试了一下,搞定了!spa

后面有人分析说由于Spring Boot会自动载入几种数据库,因此须要Datasource等等,另外一我的说只要在spring-boot-starter-data-jpa依赖中去掉hibernate-entitymanager,但我没成功,看评论也有怀疑他写错了的。还有人想取消DataSourceAutoConfiguration,有空再研究下。hibernate

reference:http://stackoverflow.com/questions/24074749/spring-boot-cannot-determine-embedded-database-driver-class-for-database-typecode

相关文章
相关标签/搜索