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>.
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.