• 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

XML based DI vs Annotation based DI

 
Ranch Hand
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dhanji,

Since frame work like Spring provide both type for DI i.e XML based and Annotation based,
but which is good to maintain code?

I like XML based DI more, What is your opinion about it ?

Thanks
 
author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Guice allows you to do this with Java in a type-safe manner. You may use annotations or skip them altogether. I prefer this approach because I signed up to write in Java not XML =)

Having said that however, there are some use cases where external configuration is more flexible and XML is appropriate for these use cases. I would not frame it as annotations vs. XML so much as Java vs. non-Java.

Dhanji.
reply
    Bookmark Topic Watch Topic
  • New Topic