[关闭]
@EggGump 2018-07-02T15:48:02.000000Z 字数 2101 阅读 453

依赖 spring data jpa

spring,maven相关


在此输入正文

First, we can enable the Spring IO Platform by adding the following XML to our POM file:

  1. <dependencyManagement>
  2. <dependencies>
  3. <dependency>
  4. <groupId>io.spring.platform</groupId>
  5. <artifactId>platform-bom</artifactId>
  6. <version>1.1.2.RELEASE</version>
  7. <type>pom</type>
  8. <scope>import</scope>
  9. </dependency>
  10. </dependencies>
  11. </dependencyManagement>

After we have enabled the Spring IO Platform, we don’t have to worry about dependency versions because the Spring IO Platform takes care of that. This means that we can get the required dependencies by adding the following XML to the dependencies section of our POM file:

  1. <!-- Database (H2) -->
  2. <dependency>
  3. <groupId>com.h2database</groupId>
  4. <artifactId>h2</artifactId>
  5. </dependency>
  6. <!-- DataSource (HikariCP) -->
  7. <dependency>
  8. <groupId>com.zaxxer</groupId>
  9. <artifactId>HikariCP</artifactId>
  10. </dependency>
  11. <!-- JPA Provider (Hibernate) -->
  12. <dependency>
  13. <groupId>org.hibernate</groupId>
  14. <artifactId>hibernate-entitymanager</artifactId>
  15. </dependency>
  16. <!-- Spring Data JPA -->
  17. <dependency>
  18. <groupId>org.springframework.data</groupId>
  19. <artifactId>spring-data-jpa</artifactId>
  20. </dependency>

自动管理依赖适用于新项目。如果是旧项目,那就手动添加

  1. <!-- Database (H2) -->
  2. <dependency>
  3. <groupId>com.h2database</groupId>
  4. <artifactId>h2</artifactId>
  5. <version>1.4.185</version>
  6. </dependency>
  7. <!-- DataSource (HikariCP) -->
  8. <dependency>
  9. <groupId>com.zaxxer</groupId>
  10. <artifactId>HikariCP</artifactId>
  11. <version>2.2.5</version>
  12. </dependency>
  13. <!-- JPA Provider (Hibernate) -->
  14. <dependency>
  15. <groupId>org.hibernate</groupId>
  16. <artifactId>hibernate-entitymanager</artifactId>
  17. <version>4.3.8.Final</version>
  18. </dependency>
  19. <!-- Spring Data JPA -->
  20. <dependency>
  21. <groupId>org.springframework.data</groupId>
  22. <artifactId>spring-data-jpa</artifactId>
  23. <version>1.7.2.RELEASE</version>
  24. </dependency>
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注