• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Architecture help

 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic