初学springboot添加spring-boot-starter-data-jpa配置项后,运行时报以上错误,检查后久后没有解决,然后改用IDEA创建maven project添加相同的配置项后却运行成功了,检查两个pom.xml配置文件,发现IDEA创建的pom.xml配置文件自动添加了
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.2.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent>
而通过eclipse创建的项目却没有自动添加,需要手动添加,而我手动添加时添加的是:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent>
就因为继承的parent版本不一样造成。