I think using annotations to configure Spring singletons is very nice - it minimizes XML while still allowing you to configure things in XML when desired. This seems to be the trend in Spring usage as well, as Spring 3.0 will be very focused on the annotation configuration support - in fact Spring MVC will be deprecating all XML configuration of controllers in favor of annotations.

Look how simple the Spring XML files are in the project. I think it's nice to have an example app that shows off the latest Spring technology as well.

I think it's debatable as to whether annotations "couple" you to Spring - obviously the JAR file is required, but there's no reason I couldn't dependency inject them using some other framework. Spring won't even create these singletons unless I tell it to in the XML file using the context:component-scan tag, so they can be configured differently in a "unit test" context, etc.. That being said, I'm not worried about it being "coupled to Spring" since it is the spring- hibernate example.

Jeremy


On Mar 9, 2009, at 10:09 AM, Les Hazlewood wrote:

Hi Jeremy,

Why did you decide to use Spring Annotations to wire your objects instead of autowiring? Now most of the business objects/DAOs in the sample app are coupled to Spring's API. I'm curious as to why you went down that road...

Les

Reply via email to