Skip to content
Sharp

Spring Core · interview question

How can you declare a custom validation constraint in Spring?

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

Correct answer

A. Create an annotation and implement ConstraintValidator

Why

To declare a custom validation constraint, you create an annotation and implement the ConstraintValidator interface. This allows you to define custom logic for your validation rule.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →