Description

Context

I've recently migrated an app from SB2.1.6 to SB2.4.4. I encountered an issue with JooqAutoConfiguration not taking into account my custom bean (some RecordListenerProvider). After a lot of digging, I discovered that the constructor signature was changed in #15751, dropping the ObjectProvider<RecordListenerProvider[]> parameter type in favour of ObjectProvider<RecordListenerProvider> (no []).

Issue

This change was committed and integrated in release 2.2.0. While that is fine in itself, even though this change have the potential to broke some integration, I was not able to find any report of it neither in the blog post nor in the release notes. The commit number was not even listed. This made the migration very slow and painful, as it was not documented anywhere. NB : Here I describe the issue encountered with the Jooq conf, but this may also affect QuartzAutoConfiguration.

Suggested solution

Considering the impacts of this change, I suggest to edit the release notes for 2.2.0 in order to add mention of it

TL;DR

2.2.0 release note is missing mention of a change that may break some configuration. The changelog should be edited to include it.


Additional notes : migrate Jooq Additional Configuration

A migration guide is provided in this post in case somebody else is facing the same situation.

In this use case, we want to use the default Jooq autoconfiguration, and provide custom beans to complete it. Here we add custom RecordListenerProciders , but this could be another type of provider. The key point is that we want to set several of these providers. All custom listeners extends DefaultRecordListener.

Configuration until 2.2.0

@Configuration
public class JooqAdditionalConfiguration {
    @Bean
    public RecordListenerProvider[] recordListenerProvider(MyRecordListener... listeners) {
        return DefaultRecordListenerProvider.providers(listeners);
    }
}

This bean provides an array, so the Spring context will contain an ObjectProvider<RecordListenerProvider[]>. This will be autowired to the autoconfiguration only for SB version < 2.2.0.

Configuration after 2.2.0

@Configuration
public class JooqAdditionalConfiguration {
    @Bean
    public RecordListenerProvider firstRecordListenerProvider(FirstRecordListener listener) {
        return new DefaultRecordListenerProvider(listener);
    }

    @Bean
    public RecordListenerProvider secondRecordListenerProvider(SecondRecordListener listener) {
        return new DefaultRecordListenerProvider(listener);
    }
}

If multiple Spring beans share the same type, they will be added to the same ObjectProvider<>, here ObjectProvider<RecordListenerProvider>. However this mean you must explicitly declare a new bean every time you add a new RecordListener to your app, you can't have a generic declaration with varargs like in previous configuration.

Comment From: wilkinsona

Sorry for the inconvenience. I've added an entry to the release notes. Thanks for taking the time to raise this issue and describe the problem you faced in detail.

IIRC, the intention here was always to inject one or more RecordListenerProvider beans rather than a single RecordListenerProvider[] bean and we have a test that checks this behaviour with a single bean.

Please note that we revisited the way in which the various …Providers are registered with jOOQ in Spring Boot 2.5. Rather than relying on beans being defined to customise jOOQ's configuration, you can now define a DefaultConfigurationCustomizer. This change is described in the 2.5 release notes.

Comment From: cchaudet

Thank you so much for your reactivity ! And thank you for the details one these design choices too, I really appreciate it.

I did heard that 2.5 introduced this customiser, and I can't wait to try it, however our app is not ready to migrate yet due to compatibility issues. But I'm looking forward to it !