Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring 3 book queston

 
Brent W Farrell
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems spring 3 seems to be moving to annotations over xml for configuration. Is there an advantage to using annotations. Will the legacy xml configuration method still be supported.
 
Lyndon Tate
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there full support for JPA (openJPA).

 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brent W Farrell wrote:It seems spring 3 seems to be moving to annotations over xml for configuration. Is there an advantage to using annotations. Will the legacy xml configuration method still be supported.


Yes, it is either-or, we can still use XML configuration file instead of Annotations.
 
Michael Swierczek
Ranch Hand
Posts: 125
1
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prefer annotations to XML because the annotations give you more compile-time checking. With XML configuration, you don't discover a spelling or misplaced node error until you actually run the application. Annotations catch many, though not all, of those kinds of errors.

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anil Vupputuri wrote:
Brent W Farrell wrote:It seems spring 3 seems to be moving to annotations over xml for configuration. Is there an advantage to using annotations. Will the legacy xml configuration method still be supported.


Yes, it is either-or, we can still use XML configuration file instead of Annotations.

Or both. You can use a mix of XML and annotations. For example, you can define beans in the XML and autowiring via annotations.
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Jeanne said...

It's not either-or. I tend to favor the annotation-based wiring. But even so, it has its limits (How could I wire a 3rd party class as a Spring bean using annotations?).
 
Ben Logan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig Walls wrote:What Jeanne said...

It's not either-or. I tend to favor the annotation-based wiring. But even so, it has its limits (How could I wire a 3rd party class as a Spring bean using annotations?).


I worked with a guy so opposed to XML wiring than he used to wrap 3rd party classes and annotate the wrapper!

Each to their own, I suppose.
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll be hanging my head and weaping a little now. :-)
 
Michael Swierczek
Ranch Hand
Posts: 125
1
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Logan wrote:
I worked with a guy so opposed to XML wiring than he used to wrap 3rd party classes and annotate the wrapper!

Each to their own, I suppose.


Okay, I admit it was tempting, but I've never gone that far.

I'm sick of XML - not that it matters, I wouldn't be surprised if I'm still wrestling with it at work in 30 years - but the one colossal advantage it has over annotations is that you don't need to recompile anything to change it.
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:
Anil Vupputuri wrote:
Brent W Farrell wrote:It seems spring 3 seems to be moving to annotations over xml for configuration. Is there an advantage to using annotations. Will the legacy xml configuration method still be supported.


Yes, it is either-or, we can still use XML configuration file instead of Annotations.

Or both. You can use a mix of XML and annotations. For example, you can define beans in the XML and autowiring via annotations.


Yes, you are true. I forgot about it. Here is another discussion going on XML config vs Annotations
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic