Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Serving a reactive template

Pragya Keshap answered on February 19, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


Serving a reactive template

0

@Controller: Spring Web’s annotation to indicate this class contains web methods that render templates.

@GetMapping: Spring Web’s annotation to map GET / web calls onto this method.

Mono: Mono is Reactor’s single-valued reactive type. Rendering is Spring WebFlux’s value type that allows us to pass both the name of the view to render along with model attributes.

Flux.fromIterable(): This static helper method lets us wrap any Java Iterable and then use our reactive APIs.

DATABASE.values(): This is a temporary data source until we get to Chapter 10, Working with Data Reactively.

collectList(): This Flux method lets us gather a stream of items into Mono>.

map(): This operation lets us access the list inside that Mono where we then transform it into a Rendering. The name of the view we wish to render is "index". We also load up the model "employees" attribute with the values found inside this Mono.

build(): Rendering is a builder construct, so this is the step that transforms all the pieces into a final, immutable instance. It’s important to understand that when inside the map() operation, the output is a Mono.

Popularity 1/10 Helpfulness 1/10 Language java
Source: Grepper
Link to this answer
Share Copy Link
Contributed on Feb 19 2023
Pragya Keshap
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.