Skip to content

Add EnableSpringDataWebFluxSupport for WebFlux support [DATACMNS-1412] #1846

Open
@spring-projects-issues

Description

@spring-projects-issues

Ankur Pathak opened DATACMNS-1412 and commented

We have this  EnableSpringDataWebSuppor in Spring MVC which makes Controller clean

for paging and provides very userful features. But this is not working with Spring Web Flux 

Controller. We should extend this support to WebFlux as well. It may be limited support

of waht we have in Spring MVC so as to keep reactive means. Because its a blocker in

migrating existing code in Spring MVC to Spring WebFlux and as it is part of Spring Data Core

it should work with both whether we are in Reactive or not Reactive world


Affects: 2.1.1 (Lovelace SR1)

Reference URL: https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/web/config/EnableSpringDataWebSupport.html

4 votes, 5 watchers

Activity

matiasah

matiasah commented on Jan 15, 2021

@matiasah
Contributor

I'm guessing spring-boot-auto-configure needs a SpringDataWebFluxAutoConfiguration to be able to declare a custom @EnableSpringDataWebFluxSupport annotation.

However, @EnableSpringDataWebFluxSupport can be declared on spring-data-commons.

added this to the 2.5 M3 (2021.0.0) milestone on Jan 25, 2021
mp911de

mp911de commented on Jan 25, 2021

@mp911de
Member

It makes sense now to add @EnableSpringDataWebFluxSupport as we have a number of components that we can register.

changed the title [-]Support for EnableSpringDataWebSupport in Spring WebFlux Controller Style [DATACMNS-1412][/-] [+]Add EnableSpringDataWebFluxSupport for WebFlux support [DATACMNS-1412][/+] on Jan 25, 2021
matiasah

matiasah commented on Jan 25, 2021

@matiasah
Contributor

I checked @EnableSpringDataWebSupport and found that it uses SpringDataWebConfiguration so I'm guessing it also needs a new SpringDataWebFluxConfiguration. What other components could possibly be necessary here?

mp911de

mp911de commented on Jan 26, 2021

@mp911de
Member

We should create a SpringDataWebFluxConfiguration that registers ReactivePageableHandlerMethodArgumentResolver and ReactiveSortHandlerMethodArgumentResolver. It would be also neat to spike on a reactive variant of ProjectedPayload to apply inbound method argument projections.

Do you want to submit a pull request or should we go forward adding SpringDataWebFluxConfiguration and @EnableSpringDataWebFluxSupport?

removed this from the 2.5 M3 (2021.0.0) milestone on Feb 17, 2021
wankaiss

wankaiss commented on Jun 3, 2021

@wankaiss

Any update for SpringDataWebFluxConfigurationSupport team? I think this will imperative in coming time as reactive becoming more and more popular 😃

onacit

onacit commented on Jul 25, 2022

@onacit

I really need this. Thanks.

matiasah

matiasah commented on Jul 26, 2022

@matiasah
Contributor

@mp911de for @ProjectedPayload I assume there needs to be a new ProjectingJackson2HttpMessageReader as WebFluxConfigurer seems to opt for http message codecs (HttpMessageReader and HttpMessageWriter) over instances of HttpMessageConverter.

For ProjectingJackson2HttpMessageConverter it inherits MappingJackson2HttpMessageConverter but there's no base class for WebFlux.

Should a MappingJackson2HttpMessageReader be in scope of spring-data-commons ? What about a ProjectingJackson2HttpMessageReader ?

Edit: I realized there's Jackson2JsonDecoder

matiasah

matiasah commented on Jul 26, 2022

@matiasah
Contributor

@mp911de I provided a ProjectingJackson2JsonDecoder in #2667 but it needs an additional change I wasn't able to tackle.

Do you know how could we implement this method in the new class?
https://github.com/spring-projects/spring-data-commons/blob/main/src/main/java/org/springframework/data/web/ProjectingJackson2HttpMessageConverter.java#L130-L135

matiasah

matiasah commented on Jul 29, 2022

@matiasah
Contributor

@mp911de I tackled the implementation of ProjectingJackson2JsonDecoder and tested it with a WebClient, it worked well but still haven't added Unit Tests yet.

Also I provided an implementation for SpringDataWebFluxConfiguration in #2667

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webIntegration with Spring MVCtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @odrotbohm@onacit@mp911de@matiasah@wankaiss

      Issue actions

        Add EnableSpringDataWebFluxSupport for WebFlux support [DATACMNS-1412] · Issue #1846 · spring-projects/spring-data-commons