Why does Maven add Hibernate Jars to dependency when I use Spring-Data
Whenever I add a dependency as below, maven also adds hibernate-entitymanager-4.3.10.jar
, hibernate-core-4.3.10.jar
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
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>com.rajkishan</groupId>
<artifactId>Test</artifactId>
<packaging>war</packaging>
<version>1.0.-SNAPSHOT</version>
<name>Test</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.8</java-version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<start-class>com.rajkishan.Application</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Spring Data JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!--Manual-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc41</artifactId>
<version>4.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<showDeprecation>true</showDeprecation>
<compilerArgs>
<arg>-verbose</arg>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
Aren't Spring-DATA and Hibernate different JPA implants?
source to share
The spring-boot-starter-data-jpa
POM dependency pulls in several JPA dependencies including Hibernate. From the official Spring documentation :
The spring-boot-starter-data-jpa POM provides a quick way to get started. It provides the following key dependencies :
Hibernate is one of the most popular JPA implementations.
Spring Data JPA - Simplifies the implementation of JPA based repositories.
Spring ORMs - Support for Core ORMs from the Spring Framework.
Thus, the Spring Data JPA JAR was designed to pull Hibernate dependencies into your project.
source to share
According to spring-boot-stater-data-jpa they will compile dependencieshibernate-entitymanager-4.3.10.jar
And hibernate-entitymanager-4.3.10 have dependencies compilation hibernate-core-4.3.10.jar
and other hiberante dependencies. Why maven Add hibernate
jars
source to share