- Spring ORM 教程
- Spring ORM - 主页
- Spring ORM - 概述
- Spring ORM - 环境设置
- Spring ORM 和 Hibernate
- Spring ORM - 创建项目
- Spring ORM - Maven Hibernate
- Spring ORM - 持久化 Hibernate
- Spring ORM - 更新项目
- Spring ORM - 运行和测试 Hibernate
- Spring ORM 和 EclipseLink
- Spring ORM - Maven EclipseLink
- Spring ORM - 持久性 EclipseLink
- Spring ORM - 更新项目 EclipseLink
- Spring ORM - 运行和测试 EclipseLink
- Spring ORM 有用资源
- Spring ORM - 快速指南
- Spring ORM - 有用的资源
- Spring ORM - 讨论
Spring ORM - Maven Hibernate
让我们在 pom.xml 中添加以下依赖项。
Spring框架
Hibernate
MySQL 连接器
其他相关依赖。
按照以下内容更新 pom.xml。
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.tutorialspoint</groupId> <artifactId>springorm</artifactId> <version>0.0.1-SNAPSHOT</version> <name>Spring ORM</name> <description>Spring ORM Test Project</description> <properties> <org.springframework.version>4.3.7.RELEASE</org.springframework.version> <org.hibernate.version>5.2.9.Final</org.hibernate.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-dbcp2</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> <version>8.0.13</version> </dependency> <dependency> <groupId>com.sun.activation</groupId> <artifactId>javax.activation</artifactId> <version>1.2.0</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>jaxb-runtime</artifactId> <version>2.3.1</version> <scope>runtime</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> </plugins> </build> </project>
现在右键单击项目名称。选择Maven → Update Project下载所需的依赖项。