• 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

Difference between Annotation based configuration and Java based configuration

 
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is difference between Annotation based configuration and Java based configuration ? please help me.
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean annotation based and xml based configuration?
Annotations are declared in Java code.
Another way is that the configurations defined in xml file.
 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Surendra Kumar

I thought same but just see this

http://www.tutorialspoint.com/spring/spring_java_based_configuration.htm
http://www.tutorialspoint.com/spring/spring_annotation_based_configuration.htm


Both uses annotation, I also referred documentation of spring but same things is there. Please help

Thank you
Hardik

 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, even then it's Java (i.e., annotation) based configuration versus the XML-based configuration.
(Not java based vs annotation based as per your original question)
You read the documentation so now you know.
Beans can be defined in an XML file or using Java classes with @Configuration annotation.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The official Spring documentation refers to configuring your beans using a Java class annotated with @Configuration and containing @Bean methods as 'Java Configuration'. This allows you to be absolutely free of all XML in your application (at least as far as Spring goes). This support was added in Spring 3.0, and has gotten more powerful since then.

It looks like the tutorials you are looking at have made a distinction on using annotations such as @Autowired and @Component for DI and scanning for and for auto-configuring beans. This support was added in Spring 2.5 and allowed users to use these annotations to reduce the amount of XML configuration they needed to do. Pre 2.5 you had to define every bean in XML. He is calling this Annotation based configuration.

These days as Surendra mentioned you either are either providing meta data in your Java class (by using annotations) or you are defining them in XML. You can of course mix the 2 approaches as well.

So it is either Java(annotation) config or it is XML.

 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok I understood. Thank you Bill Gorder, Surendra Kumar
 
Quick! Before anybody notices! Cover it up with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic