Greg L. Turnquist

Greg L. Turnquist

Test-bitten script junky & Spring Data mate

Clarksville, TN USA

Greg is a test-bitten script junky. He is a member of the Spring Data team at VMware. He works on Spring Data JPA, Spring HATEOAS, Spring Data REST, and Spring Boot. He launched the Nashville JUG in 2010. He has written many books (including Packt's best-seller "Learning Spring Boot") and is the host of Spring Boot Learning, the YouTube channel where you learn about Spring Boot and have fun doing it at
Blog Posts by Greg L. Turnquist

Ever wanted to rewrite a query in Spring Data JPA?

Sometimes, no matter how many features you try to apply, it seems impossible to get Spring Data JPA to apply every thing you’d like to a query before it is sent to the EntityManager.

With 3.0.0-SNAPSHOT (and targeted for the next milestone release train of Spring Data), you now have the ability to get your hands on the query, right before it’s sent to the EntityManager and "rewrite" it. That is, you can make any alterations at the last moment.

Check it out below:

Example 1. Declare a QueryRewriter using @Query
public interface MyRepository extends JpaRepository<User, Long> {

    @Query(value = "select original_user_alias.* from SD_USER original_user_alias",
                    nativeQuery = true, queryRewriter = MyQueryRewriter.class) // (1)
    List<User> findByNativeQuery(String param);

    @Query(value = "select original_user_alias from User original_user_alias",
                   queryRewriter = MyQueryRewriter.class) // (2)
    List<User> findByNonNativeQuery(String param);

Spring Data 2022.0.0-M3, 2021.2.0-M4, 2021.1.3, and 2021.0.10 released

On behalf of the team, I’m pleased to announce Spring Data service releases 2021.1.3 and 2021.0.10.
Both releases ship with mostly bug fixes and dependency upgrades.
For your convenience, Spring Boot 2.6.5 respective 2.5.11 are going to pick up these releases in the upcoming days.

Along with the service releases, we released the next milestone 2021.2.0-M4 of the 2021.2 release train. Spring Boot 2.7.0-M3 will pick up this release soon. We have summarized the new and noteworthy changes in our 2021.2 release notes.


Spring Web Services 3.1.1 is out!

Greetings Spring community,

The Spring Web Services team has released 3.1.1. This is the first major release under the new versioning schema. Releases will no longer have .RELEASE and snapshots will only be -SNAPSHOT, to better comply with community approaches.

While we strive to maintain alignment with Spring Framework and Spring Security, we also test against Java 8, Java 11, and Java LATEST (JDK 16 as of today).

For more details, read the following release notes for each version:

Release Notes - Spring Web Services - Version 3.1.1.

  • #1198 - Test against JDK 16 on CI.

  • #1197 - Upgrade to Spring Framework 5.3.7.

  • #1187 - Upgrade to Spring Security 5.5.0.

  • #1199 - Don’t skip main build targets during releases.

The artifacts are located on Maven Central. Get it while it’s hot!


Spring Web Services Samples have been updated!

Dear Spring community,

Spring Web Services Samples (spring-ws-samples) has been upgraded!

You might have known this, but many parts of this collection of samples goes all the way back to 2006. Today, I am happy to report it has been updated in a multitude of ways.

  • Introduction to Spring Boot

  • Introduction to Spring Data

  • Removal of outdated technologies

  • Removal of redundant samples

This was a hard-won task that took me several weeks, but based on the incredible persistence of SOAP, it was something that had to be done to serve the Spring community.


Spring HATEOAS 1.1.1.RELEASE is out!

Dear Spring community,

Spring HATEOAS 1.1.1.RELEASE is out, the first patched release of the latest stable line, supporting Spring Boot 2.3.

Among many things, you’ll find:

  • We are now listing community-led efforts to implement other media types. JSON:API and Siren are the latest. You want to add another media type? Just check out the details.

  • VndErrors is a media type for reporting, well, errors. And it has had a sneaky bug that crept in that we’ve now patched. "logref" values are no longer confined to integers. It’s important to also note that the VndErrors spec is showing no signs of life, hence we’ve deprecated its support. If you’re starting a new hypermedia-driven project, our recommendation is to use RFC-7807’s application/problem+json format instead. The API is more elegant and more importantly, under active development. And we’ve made some fixes based on community feedback.

  • We are continuing to fix memory usage issues as more people crank out hypermedia links in more intense environments.

  • Spring HATEOS has de-lomboked the source code. This effort has been applied to the latest 1.2 and this version of 1.1 as well. (Versions predating 1.1 aren’t getting backports except in very special situations.)


Spring HATEOAS brings you new ways to configure clients

Dear Spring community,

With Spring HATEOAS’s recent 1.1.0.M3 release, we bring you a new way to configure clients!

The first step in building hypermedia-based services may be configuring your server, which Spring HATEOAS has provided for a long time through its @EnableHypermediaSupport().

The next major step is building a client that can parse that hypermedia output. This has always been available, but it required you to know some of the deepest innards of the Spring Framework.

Until today.

With the latest version of Spring HATEOAS, it has been made much easier to configure RestTemplate, WebClient, or WebTestClient instances.


Spring HATEOAS 1.0.0.RELEASE is released!

Dear Spring community, we’re proud to announce the general availability of Spring HATEOAS 1.0.0.

Here’s the summary:

  • Upgrade to Spring Framework 5.2.0.RELEASE.

  • Upgrade to Reactor Dysprosium-RELEASE.

  • Upgrade to Jackson 2.10.0.

  • Clarify expected behaviour around EntityLinks when using Spring WebFlux.

  • Fix i18n support to work in broader scenarios.

  • Update documentation to show how to create an ALPS serving controller for profile purposes.

  • Fix example in docs to reflect requirement for _prompt for property I18N.

  • Update reference docs to reflect new APIs, SPIs, and package structures.


Spring HATEOAS 1.0.0.RC2 released

Dear Spring community, we’re proud to announce the second release candidate of Spring HATEOAS 1.0.0. Since our last release, Spring HATEOAS has made great strides with two more milestones and two RCs.

Here’s the summary:

  • Internationalization support for both HAL and HAL-FORMS.

  • Performance improvements

  • Spring HATEOS is now based on Spring Framework 5.2 and Reactor’s Dysprosium release train. This is critical to support downstream projects like Spring Data Moore and Spring Boot 2.2.

  • Now supports Spring WebFlux applications that have both hypermedia and non-hypermedia endpoints.

  • Improved major chunks of reference documentation.

  • Created a Spring HATEOAS Gitter channel.

  • Fixed issues in various media types to ensure they comply with spec definitions, and don’t throw unexpected exceptions.


Spring HATEOAS 1.0 M1 released

Dear Spring community, we’re proud to announce the first milestone of Spring HATEOAS 1.0. Spring HATEOAS has been in development for almost seven years now. What started as tiny extension to Spring MVC became the foundation for Spring Data REST later on and has served as a fundamental building block for hypermedia based APIs in Spring MVC applications.

We received a lot of input for more advanced features from the community and eventually decided that it was time to integrate those into the library. Also, we gained a significant amount of experience using the library in the wild and thought we should take the chance to reflect those learnings in a 1.0 release.


Spring Web Services 3.0.4 / 2.4.3 released!

Greetings Spring community,

The Spring Web Services team is releasing two version at the same time. 3.0.4.RELEASE as the main branch of development along with 2.4.3.RELEASE for maintenance.

3.0.4.RELEASE comes with a handful of features listed further below. It also comes with new support for Java 11, the next long term supported version of Java.

Java 11 and beyond

Starting in Java 9, several key Java EE packages had their visibility reduced. These included core XML and SOAP-based packages. In Java 11, these packages have been removed altogether. Since Java 11 is the first long term release since Java 8, it’s the version Spring Web Services aligns with for corresponding long term support.

What does this mean for you? To use Spring Web Services on Java 9+, you can no longer depend on the JDK providing key XML and SOAP-based libraries. Never fear, the solution is right here!

If you visit the project’s build file, you’ll discover a new Java 11 profile. This profile contains the extra dependencies you must add to your own build file in order to use Spring Web Services (or any XML/SOAP-based library for that matter).

Spring Web Services does not ship these dependencies so you’ll have to add them to your own build file. But once you do, you won’t have to worry about again (except for when newer versions of those APIs are released).

Still using Spring Web Services 2.x maintenance branch? We’ve got you covered. Without breaking backward compatibility, the 2.4.3.RELEASE also supports Java 11. It just uses a slightly older version of the SOAP API (1.3.8 instead of 1.4.0). Nothing is forced upon you, so you can continue using the same versions of everything else.

Whether or not Java 11 breaks any parts of your application outside of Spring Web Services, of course, is up to you.

For more details, read the following release notes for each version: