Spring Boot

Spring WebFlux (Reactive)

Reactive programming with WebFlux, Mono and Flux, functional routers, backpressure, reactive streams

25 câu hỏi phỏng vấn·
Mid-Level
1

What is the fundamental principle of reactive programming?

Câu trả lời

Reactive programming is based on asynchronous data streams and automatic change propagation. Unlike imperative programming where data is actively requested (pull), reactive pushes data to subscribers (push). This enables building non-blocking applications that are resilient to load changes.

2

What is the main difference between Mono and Flux in Project Reactor?

Câu trả lời

Mono is a reactive publisher that emits 0 or 1 element, ideal for operations returning a single value (like findById). Flux emits 0 to N elements, suitable for collections and streams (like findAll). This distinction optimizes performance and code semantics by clearly expressing cardinality expectations.

3

When should Mono<T> be used instead of Flux<T>?

Câu trả lời

Use Mono when the operation returns 0 or 1 result maximum, such as fetching a user by ID, saving an entity, or making an HTTP request that returns a single object. This communicates code intent and enables internal optimizations. Flux would be inappropriate as it implies a potentially large collection.

4

What is the typical use case for Flux<T>?

5

What is the fundamental difference between Spring WebFlux and Spring MVC?

+22 câu hỏi phỏng vấn

Nắm vững Spring Boot cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí