Results 1 to 2 of 2

Thread: @Repository and <mongo:repositories base-package/>

  1. #1
    Join Date
    Mar 2008
    Posts
    29

    Question @Repository and <mongo:repositories base-package/>

    Should I use @Repository on my beans inside mongo:repositories base-package?
    All of my repository beans extends MongoRepository, so they will be detected by mongo:repositories instruction, although I'm not sure about automatic exception translation (should I add @Repository for each of my repository bean), and will it work just with mongo:repositories? I use <context:component-scan base-package/> to activate @Repository lookup, but component-scan base-package is different from mongo:repositories base-package.

    So, summarize:
    1. will mongo:repositories handle nicely @Repository annotation on my MongoRepository beans?
    2. if yes, than will it provide automatic exception translation for my beans, or this is done by default, and I don't need @Repository at all.

  2. #2
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    You don't need @Repository. The exception translation is automatically applied on the MongoTemplate level so that the repositories benefit from it transparently.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •