The Spring Blog

Engineering
Releases
News and Events

What's new in Spring Data Moore?

Spring Data Moore ships with 16 modules and over 700 tickets completed. It includes tons of improvements and new features across the portfolio and has a strong focus on three major topics: Reactive, Kotlin, and Performance. The release adds features such as declarative reactive transactions and Coroutines/Flow support and comes with up to 60%* faster finder methods.

Let’s start with a look at some of the Reactive features of Moore.

Declarative, reactive transactions

The Lovelace Release introduced early support for reactive transactions in a closure-fashioned style that left some room for improvements. The following listing shows that style:

Reactive Transactions in Lovelace (with MongoDB)
public Mono<Process> doSomething(Long id) {

  return template.inTransaction().execute(txTemplate -> {

    return txTemplate.findById(id)
      .flatMap(it -> start(txTemplate, it))
      .flatMap(it -> verify(it))
      .flatMap(it -> finish(txTemplate, it));

  }).next();
}

In the preceding snippet, the transaction has to be initiated by explicitly calling inTransaction() with a transaction-aware template within the closure, calling next() at the end to turn the returned Flux into a Mono to satisfy the method signature, even though findById(…) already emits only a single element.

Obviously, this is not the most intuitive way of doing reactive transactions. So let’s have a look at the same flow using declarative reactive transaction support. As with Spring’s transaction support, you need a component to handle the transaction for you. For reactive transactions, a ReactiveTransactionManager is currently provided by the MongoDB and R2DBC modules. The following listing shows such a component:

@EnableTransactionManagement
class Config extends AbstractReactiveMongoConfiguration {

  // …

  @Bean
  ReactiveTransactionManager mgr(ReactiveMongoDatabaseFactory f) {
    return new ReactiveMongoTransactionManager(f);
  }
}

From there, you can annotate methods with @Transactional and rely on the infrastructure to start, commit, and roll back transactional flows to handle the lifecycle via the Reactor Context. This lets you turn the code from Lovelace into the following listing, removing the need for the closure with its scoped template and the superfluous Flux to Mono transformation:

Declarative Reactive Transactions in Moore (with MongoDB)
@Transactional
public Mono<Process> doSomething(Long id) {

  return template.findById(id)
    .flatMap(it -> start(template, it))
    .flatMap(it -> verify(it))
    .flatMap(it -> finish(template, it));
}
Read more...

Reactor Dysprosium (3.3.x) goes GA

Hello Reactor community,

On behalf of the Reactor team and its heroic new contributors, I am delighted to announce that Reactor Dysprosium can now be found on your preferred Maven repositories, like this one.

It is the fourth release train since Reactor Core 3.x and it includes Reactor Core 3.3, Reactor Netty 0.9 and a newcomer, Reactor Pool 0.1. Check out the major change logs and release notes:
- reactor-core 3.3.0.RELEASE
- reactor-netty 0.9.0.RELEASE
- reactor-pool 0.1.0.RELEASE

Reactor Dysprosium modules still require JDK 8 or higher. They come with many performance improvements and we even have identified more areas to focus on the next patches and major releases. Please join me in giving a warm welcome to a new module to the family, Reactor Pool. It is the generic embeddable reactive object pool you were waiting for. It is used by Reactor Netty and we plan to build more features on top of it. As with Reactor Netty, we haven’t qualified a major “1.x” release as we expect tweaks before considering it API stable.

Read more...

Reactor Californium-SR12 is out

The 12th Service Release for Californium is out. As per tradition, it fixes several issues and bring improvements all around.

The release is available on your preferred maven central repository.

Change logs and release notes:
- reactor-core 3.2.12.RELEASE
- reactor-netty 0.8.12.RELEASE

Bismuth EOL

With Dysprosium-RELEASE, our reactor-core 3.1.x and reactor-netty 0.7.x lines will not receive further patches. We encourage our users to update to Californium releases trains, which match Spring Boot 2.1.x and Spring Framework 5.1.x.

Read more...

This Week in Spring - October 1, 2019 - Spring Framework 5.2 Edition

Oh emm geee y’all! We just released Spring Framework 5.2, complete with new RSocket support, and a slew of projects have followed suit in the intervening… day! I expect we’ll see more soon, followed not too far behind by Spring Boot! And, of course, next week is the biggest week in all of Springdom every week: SpringOne Platform 2019!

I can’t wait to get there, but first I’m off to Taipei for the JCCConf. THere’s a ton to get to let’s dive right in!

Read more...

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.

Read more...

This Week in Spring - September 24th, 2019

Hi Spring fans! Welcome to another installment of This Week in Spring, a weekly roundup where I get to swim through the great content in the ecosystem and learn things and hopefully share interesting tidbits with you all. I mark my calendar by the number of This Week in Springs, so imagine my elation to realize looking at the calendar that we’re really close to the epic SpringOne Platform 2019! I can’t believe it!

The event takes place soon - October 7–10, 2019 - in Austin, Texas. That’s just around the corner, but I’ve still got a few places to get to. I’m in Madrid, Spain, for the epic CodeMotion Madrid show. Then it’s off to Guadalajara, Mexico for the Java day Mexico show; and then it’s off to Taipei, Taiwan for the JCConf lead by the Taiwan JUG. Then, finally, it’s off to the land of BBQ and Spring, SpringOne Platform! I can’t wait to see you all there.

Read more...

This Week in Spring - Sept 17, 2019

Hi, Spring fans! Welcome to another installment of This Week in Spring - and what a week it is! I’m at the epic annual eventapalooza that is Oracle CodeOne (formerly JavaOne). I just finished a talk today on reactive programming and I’ll have another talk on Kotlin on Wednesday. Don’t miss it!

Meanwhile, we’ve got a ton of things to get to this week so let’s get to it!

Read more...