I am creating one web application using Spring and hibernate.
I am little confused about the approach for directory structure.
Approach 1:
Create separate folder/package for each module.
Example, If i have to create login and uploadfile module and my base package is com.abc then i will create package com.abc.login and inside that i will create controller,service,form,dao folders and same for uploadfile model.
Appraoch 2:
Under the same project create controller,service,form,dao folders and then add all controller classes for all modules under com.abc.controller and so all services for all modules under one service folder and so forms and daos
Which approached should I follow ?
The packages are just a way to group together classes that make sense to go together, and avoiding name clashes with other classes. It has absolutely 0 impact on performance. Do whatever you find the best. Both approaches are common (technical-based separation first vs. functional-based separation first).
I prefer your first approach (functional-based separation first), but YMMV.