• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Spring Architecture help

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
reply
    Bookmark Topic Watch Topic
  • New Topic