• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Annotation in spring

 
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 352
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 352
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
= no XML file
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic