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

Support reactive data types for spring mvc #155

Open
joshiste opened this issue Aug 29, 2017 · 2 comments
Open

Support reactive data types for spring mvc #155

joshiste opened this issue Aug 29, 2017 · 2 comments
Assignees
Milestone

Comments

@joshiste
Copy link

Will there be also support for using Flux or Mono in the model with servlet based Spring 5 applications?

@danielfernandez
Copy link
Member

What type of support would you be expecting for these, at the Spring MVC side?

At first thought, including a dependency on Reactor at the Spring MVC side could be an issue, but anyway I would be interested in knowing what kind of scenario would we be talking about... note the servlet web framework is blocking itself so… would you get a real advantage from using reactive data streams there?

@joshiste
Copy link
Author

joshiste commented Aug 30, 2017

At first thought, including a dependency on Reactor at the Spring MVC side could be an issue

I don't think so. For using the reactive WebClient inside a servlet application you have to even include Spring Webflux. Imho that's a valid use case.

What type of support would you be expecting for these, at the Spring MVC side?

most simple: I think it would be just convenient if we could pass a Flux into the model and Thymleaf can iterate on them using th:each. (Currently you need to call toIterable() on the Flux in the controller beforehand). The rendering itself would indeed be blocking.

more advanced: Afaik Spring MVC is capable of turning a Flux into SSEs using the async serlvet api. May be there is a way to easy support this with Thymeleaf. (But maybe it's much easier to map the Flux by calling Tyhmeleaf for every single item, and leave the rest of the SSE work to spring mvc)

would you get a real advantage from using reactive data streams there?

From a developers perspective it would be just for the ease of use. As you pointed out since the rendering is still blocking you would gain no further advantages.

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

No branches or pull requests

2 participants