This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Annotation in spring

 
Harshana Dias
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As Spring 3.0 support annotation to configure beans using @configuration and @bean there is no need of declare beans in the xml file right? so i guess in future the class XmlBeanFactory will be deprecated? Any comments on which way is more efficient?

Thank You.
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
^^

You didn't completely go with Annotations. Each has their oen pros and cons. I prefer Annotations, but that doesnt mean XML is obsolete. You will get to know the use if and only if you work on it.
 
Harshana Dias
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajkumar balakrishnan wrote:^^

You didn't completely go with Annotations


Yes Rajkumar. Im kind of start studing spring and read a simple article. And i just thought of it
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a general trend with more than just Spring and comes under the general heading of "zero configuration". You can see similar stuff in Java EE, for example.

However, annotations by themselves have problems, since if they were left unattended, they'd require hard-wiring of component relationships and configuration parameters. That would remove a lot of Spring's flexibility to allow reusable code, plugin components, and special wiring for test frameworks.

So the actual process (in Spring and elsewhere) is that if an XML file exists, it will override the annotations. That way you can take a "management by exception" approach, code the information in the Java files (where appropriate), but still be able to customize it by external directives in the XML file.

So XML is not obsolete, just no longer the only way to do things.
 
Harshana Dias
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankx Tim for the reply...by the way what you mean by "if they were left unattended"?
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
= no XML file
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Annotations and find it too easy but still i need XML for some tasks. I hope you understand what i am saying.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic