Skip to content
Sharp

Spring Core · interview question

Which Spring Boot feature helps in rejecting invalid data before it hits the service layer?

Multiple choiceMediumchapter-9-curatedpremiumspring-corepersistence-and-validation
Choose one answer
Answer and explanation

Correct answer

C. @Valid

Why

@Valid is used in Spring Boot to trigger validation on method parameters, such as request bodies. It helps in rejecting invalid data at the controller level, thus preventing bad data from reaching the service layer.

Test yourself on Spring Core

A free test with instant, explained results. No account needed.

Start free test
All Spring Core questions →