Priya
Priya

Reputation: 1226

why is JPA dependency needed for flyway migrations to run

Hi ,
I am new to Spring boot gradle Project .I am trying to run flyway migration with spring boot application. This is how I set dependencies in gradle,

First , I added the dependency as , org.springframework.boot:spring-boot-starter-web . this was sufficient to expose an end point .

Then I tried to add flyway dependency in gradle as , org.flywaydb:flyway-core:4.0 , it was neither throwing error nor running the migration scripts , until I have added the dependency org.springframework.boot:spring-boot-starter-data-jpa:1.3.5.RELEASE . After seeing to the pom.xml of data-jpa jar, I identified the dependencies for this jar has hibernate packages as well org.springframework.boot:spring-boot-starter-web. So I removed the first dependency jar added . But the service start up failed . My doubt is :

1) What is the necessity that JPA library should be added to run flyway scripts
2) If that org.springframework.boot:spring-boot-starter-web is a dependency for the jar org.springframework.boot:spring-boot-starter-data-jpa:1.3.5.RELEASE , why should I add that once more

Upvotes: 0

Views: 823

Answers (1)

N. Labrahmi
N. Labrahmi

Reputation: 667

Using Flyway naturally means dealing with a data source of some kind, otherwise what would be the point of adding a database migration library to your project?

When you add the Flyway dependency, by default Spring Boot will automatically autowire Flyway with its data source and invoke it on startup as per the documentation.

Thus the need for a JPA library.

Upvotes: 1

Related Questions