Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
spring-projects-issues opened this issue Oct 28, 2018 · 9 comments
Assignees
Labels
in: web Integration with Spring MVC type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

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

@matiasah
Copy link
Contributor

matiasah commented Jan 15, 2021

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.

@mp911de
Copy link
Member

mp911de commented Jan 25, 2021

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

@mp911de mp911de changed the title Support for EnableSpringDataWebSupport in Spring WebFlux Controller Style [DATACMNS-1412] Add EnableSpringDataWebFluxSupport for WebFlux support [DATACMNS-1412] Jan 25, 2021
@matiasah
Copy link
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
Copy link
Member

mp911de commented Jan 26, 2021

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?

@mp911de mp911de removed this from the 2.5 M3 (2021.0.0) milestone Feb 17, 2021
@wankaiss
Copy link

wankaiss commented Jun 3, 2021

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

@onacit
Copy link

onacit commented Jul 25, 2022

I really need this. Thanks.

@matiasah
Copy link
Contributor

matiasah commented Jul 26, 2022

@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
Copy link
Contributor

matiasah commented Jul 26, 2022

@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
Copy link
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
Labels
in: web Integration with Spring MVC type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

6 participants