see https://github.com/spring-projects/spring-data-commons/commit/5dd7b322b65652f90717c4f8cb930c5e471ad483

Comment From: quaff

Please hold on until Spring Data Bom 2024.0.0 released.

Comment From: wilkinsona

I labelled this as blocked but neglected to say why. We're waiting for the outcome of https://github.com/spring-projects/spring-data-commons/pull/3054.

Comment From: odrotbohm

It could be that I am missing something here, but the presence of a SpringDataWebSettings is an indication of a user-provided @EnableSpringDataWebSupport annotation. Shouldn't it be possible to simply guard the creation of the SpringDataWebSettings bean here with the presence of one of the ImportBeanDefinitionRegistrars the annotation registers and of course the lack of a SDWS bean definition itself?

It feels a bit weird to, if the annotation is configured, not forward its configuration default value into downstream configuration setup. That extending into having to write that latter code re-implementing a default that's already set and conveyed through the annotation attribute's value.

Comment From: wilkinsona

Thanks, @odrotbohm.

Adding a configuration property to flip that switch might be nice, but at the same time, I wonder whether having to use the annotation isn't just enough?

As things stand, if you use the annotation, you'll lose our customization of paging and sorting.

Shouldn't it be possible to simply guard the creation of the SpringDataWebSettings bean here with the presence of one of the ImportBeanDefinitionRegistrars the annotation registers.

We already use @EnableSpringDataWebSupport in our auto-configuration when we detect that the user hasn't already used it. Unfortunately, SpringDataWebSettingsRegistar then always registers a SpringDataWebSettings that we can't (easily) replace. We can work around this with two different classes (ignoring fuzzier matching of direct and via-dto:

    @Configuration(proxyBeanMethods = false)
    @EnableSpringDataWebSupport
    @ConditionalOnProperty(name = "spring.data.web.pageable.serialization-mode", havingValue = "direct",
            matchIfMissing = true)
    class EnableSpringDataWebSupportConfiguration {

    }

    @Configuration(proxyBeanMethods = false)
    @EnableSpringDataWebSupport(pageSerializationMode = PageSerializationMode.VIA_DTO)
    @ConditionalOnProperty(name = "spring.data.web.pageable.serialization-mode", havingValue = "via-dto",
            matchIfMissing = false)
    class EnableCustomizedSpringDataWebSupportConfiguration {

    }

https://github.com/spring-projects/spring-data-commons/pull/3054 would remove the need for this little bit of complexity in Boot.

Comment From: snicoll

@odrotbohm could you please review the comment above when you get a chance? Thanks!

Comment From: odrotbohm

I'm sorry this took so long to get to. I've merged @quaff's contribution and ported it back into the 3.3.x branch. We now do not register a SpringDataWebSettings bean anymore, unless a non-default value for pageSerializationMode is set. Hope this eases the situation for Boot. Please let me know, if there's anything else we can do.

Comment From: quaff

@Primary removed now.

Comment From: wilkinsona

Thank you, @quaff.