Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring or your own factory?

 
Bob Lawson
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring is great and I use it a lot. But when I have a lot of object wiring to do, Spring can get cumbersome. Also, some of your business logic actually ends up in the config file rather than code. This is because when you abide by the single responsibility principle and divide up responsibilities into separate, the business rules are driven out of the code and into relationships between the classes. I find that doing the wiring in my own factory using good old java code is sometimes easier to understand than reading the xml, which can get pretty crazy.

Thoughts?
 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Starting with Spring 3.0 JavaConfig comes bundled together. Prior to that, it was a standalone extension. The configuration comes in plain Java classes with annotations but the annotations are only in the configuration classes, not in the beans themselves - this way people who hate adding third-party annotations can extract the config classes to a separate module, for example. If you worked with Guice, this is kind of similar to its Modules.
I really suggest you take a look at this old / new feature.
 
Bob Lawson
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info - I did not know about that. Sounds like just what I'm looking for. I will certainly give it a try!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic