java – Does Spring Data JPA require Spring Boot?

java – Does Spring Data JPA require Spring Boot?

No, you are perfectly fine to use Spring Data JPA by itself.

Do note that Spring Boot makes it easier to set up a project, all Spring Data JPA examples use:


After trying, I found it is possible to use Spring Data JPA with plain Spring, without spring boot.

When not using boot, the following are needed:

1) spring-core maven dependency

2) spring-context dependency

3) spring-data-jpa dependency

4) hibernate-entitymanager or some other JPA provider

5) mysql-connector-java or some other DB connector

6) javax.persistence-api dependency

7) AnnotationConfigApplicationContext instead of SpringBootApplication

8) @EnableJpaRepositories(mypackage)

9) @ComponentScan(mypackage)

10) @Bean for LocalContainerEntityManagerFactoryBean and dataSource

11) Setting Hibernate properties to EntityManager

12) @Bean for PlatformTransactionManager

java – Does Spring Data JPA require Spring Boot?

You can use Spring without Boot module but, in your case, youll have to consider building an project containing Spring Core + Data + JPA and run it inside an Application Server.

If you just do some small example, like you said, Spring Boot + Data + JPA might be faster and easier to setup and run.

Leave a Reply

Your email address will not be published. Required fields are marked *