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

  • Home
  • SEARCH
  • 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 4612288
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:22:57+00:00 2026-05-22T01:22:57+00:00

I’m looking for some best practices when using Spring 3 annotations . I’m currently

  • 0

I’m looking for some best practices when using Spring 3 annotations.

I’m currently moving to Spring 3 and from what I’ve read so far I see a lot of accent placed on using annotations and moving away from XML configuration.

Actually what is recommended is a mix of both styles, with annotations covering things that won’t change often or from one run to the next (e.g. a @Controller will remain like that for the life time of the application), while the things that change and must be configurable go into XML (e.g. a mail smtp address, endpoints for web services that your application talks to etc).

My question is what should go into annotations and to what extent?

At which point annotations make things harder instead of easier? Is the technology (Spring 3) fully adopted as to be able to make such statements or does it take some more time for people to gain experience with it and then reflect on the issue?

  • 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-05-22T01:22:58+00:00Added an answer on May 22, 2026 at 1:22 am

    It is always difficult to get real advanced information.

    The easy tutorial with “look on my blog, I copied the hello word tutorial from Spring Source website… Now you can put fancy annotations everywhere, it the solution of all of our problems including cancer and starvation.” is not really usefull.

    If you remember right spring core had several purposes, among them:

    • to be non intrusive
    • to change any
      implementation/configuration of a
      bean at any time
    • to give a centralized and controlled
      place to put your configuration

    Anotation fail for all theses needs:

    • They introduce coupling with spring
      (you can use standard anotation only
      but as soon as you have at least one
      spring anotation this is no longer
      true)
    • You need to modify source code and
      recompile to change bean
      implementation or configuration
    • Annotations are everywhere in your
      code. It can be difficult to find
      what bean will be really used just by
      reading the code or XML configuration
      file.

    In fact we have shifted our focus:

    • We realized that we almost never
      provide several implementations of
      our services.
    • We realised that being dependant of
      an API is not that bad.
    • We realized that we use spring not only
      for real dependancy injection
      anymore, but mainly to increase
      productivity and reduce java code
      verbosity.

    So I would use anotations when it make sence. When it is purerly to remove boilerplate code, verbosity. I would take care of using the XML configuration file for thing that you want to make configurable, even if it is only to provide a stub implementation of the service in unit tests.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I have some data like this: 1 2 3 4 5 9 2 6
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm making a simple page using Google Maps API 3. My first. One marker
I want use html5's new tag to play a wav file (currently only supported

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.