Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot and Spring Data Jpa versions compatiblity

I am using the latest (by the time of writing) Spring-Boot-starter-data-jpa (version 1.2.6.RELEASE). I find it actually uses the Spring-data-jpa version 1.7.3.RELEASE, which is considerably behind the latest (1.9).

Is it a supported approach to upgrade individual dependencies such as the Spring-data-jpa? If I do this myself, for example, by declaring a direct dependency on the wanted newer version (may just override the version properties), any side effect you guys foresee?

The reason why I am doing this is that I need to use a special parameter in this annotation:@EnableJpaRepositories(repositoryBaseClass = JpaRepositoryWithI18n.class)

That is not available in the supplied 1.7.3 jpa library.

Any workaround would be appreciated too.

Thanks

EDIT: I tested the following two ways: 1) declared a direct dependency to Spring-JPA-data 1.9.0 and excluded it from spring-boot-starter-data-jpa 2) upgrade Spring-boot-web-starter to 1.3.0m5

2) worked out well for me. This is also what dunni's answer suggested.

I have not tested Andi's answer as this is a new project, we could easily upgrade the entire spring boot and regression test it without worrying too much about side-effects.

But I can see Andi's answer is an easier approach than 1). More importantly, it shows how you can upgrade other dependencies independently -- just overide the versions in parent pom.

Thanks

like image 307
Jason Wang Avatar asked Mar 15 '23 14:03

Jason Wang


1 Answers

Spring Data JPA 1.9 is part of the Spring Data Gosling release train. As described in the Gosling announcement you can use it with Spring Boot 1.2:

To upgrade to the new release train use the BOM we ship as described in our examples repository and configure its version to Gosling-RELEASE. If you’re using Spring Boot, upgrading to the release train is as easy as setting the Maven property spring-data-releasetrain.version to that version. Note, that to use Spring Data REST with Boot 1.2, you also need to upgrade to Spring HATEOAS 0.19.0.RELEASE (by setting the spring-hateoas.version property) and Jackson 2.5 or better (current 2.6.1 preferred, via the jackson.version property).

In short, add this to your pom:

<properties>
    <spring-data-releasetrain.version>Gosling-RELEASE</spring-data-releasetrain.version>
</properties>
like image 196
Andy Wilkinson Avatar answered Mar 17 '23 20:03

Andy Wilkinson