wood burning stoves 2.0*
The moose likes Spring and the fly likes Spring Architecture help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Architecture help" Watch "Spring Architecture help" New topic
Author

Spring Architecture help

Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 226
I am at beginner level of designing apps in spring. That's why i am posting here to seek suggestions and help from you guys.

the project was based on simple daos with hibernate, struts and front end is using struts + freemarker (freemarker only at few pages). now the very first task it so add spring to handle the beans. I have break up my task as

1: spring beans injections
2: spring transaction management
3: spring bean injectsion in sturts actions etc.

for part 1, I am just pulling up the DAO to DAO Interfaces and adding the bean entry in application context


- for classes which are already using these daos, will get these beans from webcontext of spring.
- right now the transaction wil be managed with transaction util class which was already being utilized

My question here is it the right approach? (since i have no one aruond me to consult on it). Secondly how can i test it ? right now i have added some logging msgs in beans constructor which are pritned when maven build the project and run it.


The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Personally, I would add a Service layer to act between your Controller/Struts Action classes and your DAOs. This will allow for more flexibility later if you decide on adding business logic, which should not be in either your Actions or DAOs, they belong in their own layer.

Hope that helps.

Also make sure the Service classes have interfaces too.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 226
yeah, that was my proposal to the senior management to add the service layer as well. well what would be heirarchy then if i add service layer ?

i.e suppose the struts have controller name countryAction and the DAO's name i already mentioned. then there will be another third class say, countryService in between those? or what ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Architecture help
 
Similar Threads
Generic DAO using Spring
replace bean definition in another project
Pass DB connection on the fly to hibernate session for the DAO based on spring-HibernateDaoSupport
Access DAO from jsp
Hibernate Transactions