File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Container classes in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Container classes in Spring" Watch "Container classes in Spring" New topic
Author

Container classes in Spring

Padma Prasad
Ranch Hand

Joined: Sep 16, 2002
Posts: 76
What are the container classes in Spring? I would like to know which classes do we need to use to implement Spring in the business layer.

The design is Struts + Spring + Hibernate.

Lots of Thanks,
Angel.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
What do you mean by "container classes"? Do you mean "how do I use Spring as just an IoC container"? If so, I'd start here.


James Carman, President<br />Carman Consulting, Inc.
Padma Prasad
Ranch Hand

Joined: Sep 16, 2002
Posts: 76
No. My question is what clases do we require to overwrite to work with Spring.

Thanks for the reply. That was instant.

Angel.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
I don't think I understand what you're looking for. You want to know what you have to override to use Spring? You don't have to override anything to use Spring, in general. What exactly is it that you're trying to do?
Padma Prasad
Ranch Hand

Joined: Sep 16, 2002
Posts: 76
Apologize for the confusion. My question was wrong. I was to ask in a different way.

What are the necessary classes of Spring do I need to extend to write my own logic.

for eg, in struts, we have our own classes extending Action Form, Action classes etc.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
That's one of the best things about Spring! You don't have to extend any Spring classes to use it.
Craig Walls
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 301
Originally posted by James Carman:
That's one of the best things about Spring! You don't have to extend any Spring classes to use it.


That's only partially true. To use Spring IoC, you don't have to subclass or implement anything. Just wire up your POJOs in the XML file and you're set.

But, if you're using some of the sub-frameworks, you may have to subclass or implement some Spring-specific stuff. For example, if you're using Spring MVC, you'll need to *at least* implement the Controller interface and more likely extend one of the many Controller implementation classes that come with Spring.

The author of the original question said that their app is Struts + Spring + Hibernate. In that case, you'll still implement your Struts layer the same as if Spring wasn't a factor (ie, subclass Action). In the middle, it just depends on what you're doing on whether you'll need to subclass Spring-specific stuff or not. In the persistence layer, you'll probably want to write your DAOs to subclass HibernateDaoSupport (although that's optional...you'll just have to manage your Hibernate sessions yourself if you don't).

To sum it up...if you're using only the IoC part of Spring, then you don't need to subclass or implement anything Spring-specific. But when you start using some of Spring's sub-frameworks, you may need to subclass a Spring-specific class here and there...it really just depends on what you're doing.


Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Container classes in Spring