Spring MVC 应用程序使用的这个 Spring 数据模型项目的配置究竟意味着什么?
What exactly means the configuration of this Spring data model project used by a Spring MVC application?
我是 Spring + JPA 的新手,我正在开发一个使用名为 model-gen-myapp.[=13= 的项目的 Web 应用程序]
此项目包含实体 class 注释以映射数据库 table(因此它包含我的 Web 应用程序用来表示数据库上数据的模型)。
这是本项目的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
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>model-gen-profdb</groupId>
<artifactId>model-gen-profdb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.11.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.8.2.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.3</version>
</dependency>
</dependencies>
</project>
正如您在前面的配置中看到的那样,它添加了一些与一些 Hibernate 相关的依赖项和 spring-data-jpa Spring 项目。
之前的依赖项到底是用来做什么的?
然后,如果我 select 这个项目进入 Eclipse 项目资源管理器并且我这样做: Properties ---> Project Facets 我发现检查了以下方面 Java(版本 1.7)、JPA(版本 2.1) 和 实用程序模块.
项目方面到底是什么,之前的选择是什么意思?不明白这玩意是不是加了依赖还是跟某个项目配置有关?
首先让我向您介绍强大的 Maven here ,请阅读。
Dependency management is one of the most important features of Maven
which is best known to its users and is one of the areas where Maven
excels.
您的项目是JPA项目,hibernate-jpa-2.1-api
是为您提供JPA 2.1 API。您可以访问它 here。它基本上有这些父包:
javax.persistence
javax.persistence.标准
javax.persistence.元模型
javax.persistence.spi
JPA 是一个 specification from Oracle. The venders like Hibernate
, Eclipse Link
etc has the actual implementation of this specification. Hence you need the hibernate core hibernate-core
jar. Read about Hibernate here.
即将spring-data-jpa
。 Spring Data JPA 是更大的 Spring 数据系列的一部分,可以轻松实现基于 JPA
的 repositories
。此模块处理对基于 JPA
的 data access layers
的增强支持。它使构建使用数据访问技术的 Spring 支持的应用程序变得更加容易。资料来源:Spring Data JPA
Eclipse 中的 Project Facets:将在项目中使用的一个方面,以便 IDE 可以在生成器、向导、自动包含库和很快。例如,如果您添加 JPA 方面,那么您将获得更多选项来使用 JPA 执行 IDE-magic。这里你的项目使用Java 1.7, JPA 2.1等。资料来源:What is 'Facet' in JavaEE?
希望对您有所帮助!
我是 Spring + JPA 的新手,我正在开发一个使用名为 model-gen-myapp.[=13= 的项目的 Web 应用程序]
此项目包含实体 class 注释以映射数据库 table(因此它包含我的 Web 应用程序用来表示数据库上数据的模型)。
这是本项目的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
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>model-gen-profdb</groupId>
<artifactId>model-gen-profdb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.11.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.8.2.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.3</version>
</dependency>
</dependencies>
</project>
正如您在前面的配置中看到的那样,它添加了一些与一些 Hibernate 相关的依赖项和 spring-data-jpa Spring 项目。
之前的依赖项到底是用来做什么的?
然后,如果我 select 这个项目进入 Eclipse 项目资源管理器并且我这样做: Properties ---> Project Facets 我发现检查了以下方面 Java(版本 1.7)、JPA(版本 2.1) 和 实用程序模块.
项目方面到底是什么,之前的选择是什么意思?不明白这玩意是不是加了依赖还是跟某个项目配置有关?
首先让我向您介绍强大的 Maven here ,请阅读。
Dependency management is one of the most important features of Maven which is best known to its users and is one of the areas where Maven excels.
您的项目是JPA项目,
hibernate-jpa-2.1-api
是为您提供JPA 2.1 API。您可以访问它 here。它基本上有这些父包:javax.persistence
javax.persistence.标准
javax.persistence.元模型
javax.persistence.spiJPA 是一个 specification from Oracle. The venders like
Hibernate
,Eclipse Link
etc has the actual implementation of this specification. Hence you need the hibernate corehibernate-core
jar. Read about Hibernate here.即将
spring-data-jpa
。 Spring Data JPA 是更大的 Spring 数据系列的一部分,可以轻松实现基于JPA
的repositories
。此模块处理对基于JPA
的data access layers
的增强支持。它使构建使用数据访问技术的 Spring 支持的应用程序变得更加容易。资料来源:Spring Data JPAEclipse 中的 Project Facets:将在项目中使用的一个方面,以便 IDE 可以在生成器、向导、自动包含库和很快。例如,如果您添加 JPA 方面,那么您将获得更多选项来使用 JPA 执行 IDE-magic。这里你的项目使用Java 1.7, JPA 2.1等。资料来源:What is 'Facet' in JavaEE?
希望对您有所帮助!