Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:53:33+00:00 2026-06-11T23:53:33+00:00

I have three layers in my application: REST interface (JBOSS RestEasy) Service layer (Spring

  • 0

I have three layers in my application:

  • REST interface (JBOSS RestEasy)
  • Service layer (Spring Services)
  • Persistence layer (Spring beans)

In the persistence layer I will implement two classes (which implement the same interface): one will be a MemoryStore and the other one FileSystemStore.

Should these implementation be annotated by @Repository?

The two classes will not have any Database access. It can comes later an implementation to a DatabaseStore but it is not the case now.

More generally, is the annotation @Repository must be used for any persistence Bean or only for those who access a Database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:53:35+00:00Added an answer on June 11, 2026 at 11:53 pm

    The class javadoc says:

    A class thus annotated [with @Respository] is eligible for Spring
    DataAccessException translation when used in conjunction with a
    PersistenceExceptionTranslationPostProcessor. The annotated class is
    also clarified as to its role in the overall application architecture
    for the purpose of tooling, aspects, etc.

    I believe that you must annotate your class with @Repository if you need special exception translation (from JDBC, Hibernate or some other) or your own technology (but that means that you have to extend spring to know about this) otherwise, just annotate with @Component.

    In your specific case, I think it is correct to annotate with @Repository because your interface is designed for data persistence.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net mvc application with three layers: - data layer with entities
I have a REST web-service interface that calls-down to a service layer which orchestrates
I have an application, which will have a view layer organized in three parts:
I have an application with three layers (Presentation, Business Logic, and Data Access). In
i have a data access layer that abstracts the rest of the application away
My WCF application receive RequestContext from UI, and I have three layer before fetching
We have an application in which we have created a service layer with most
I'm developing a Client-Server-Application with Hibernate as persistence layer and Jersey REST for network
I have a Spring app which launches a REST Service within an embedded instance
I have a application set up like a three layer cake: where the upper

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.