Skip to content
Sharp

Spring Core · interview question

Which annotation should be used to indicate a class as a Spring Data Repository?

Multiple choiceEasychapter-9-curatedpremiumspring-corecontrollers-services-repositories
Choose one answer
Answer and explanation

Correct answer

D. @Repository

Why

@Repository is the annotation that marks a class as a Spring Data Repository. It is part of the persistence layer and is responsible for data access, CRUD operations, and possibly custom queries.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →