Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Spring MVC Package Structure

  • 14-07-2014 9:10am
    #1
    Registered Users, Registered Users 2 Posts: 2,815 ✭✭✭


    Is there any convention about how to structure packages in a Spring MVC application. Should I structure them based on the system’s logically separate business units or based on the Spring MVC architecture.

    For example, this (logically separate business units):

    com.mycompany.myapp.product
    - Product
    - ProductDao
    - ProductService
    - ProductController
    com.mycompany.myapp.user
    - User
    - UserDao
    - UserService
    - UserController
    com.mycompany.myapp.review
    - Review
    - ReviewDao
    - ReviewService
    - ReviewController


    Or this (Spring MVC architecture)

    com.mycompany.myapp.beans
    - Product
    - User
    - Review
    com.mycompany.myapp.dao
    - ProductDao
    - UserDao
    - ReviewDao
    com.mycompany.myapp.service
    - ProductService
    - UserService
    - ReviewService
    com.mycompany.myapp.controller
    - ProductController
    - UserController
    - ReviewController


    Thanks


Comments

  • Moderators, Sports Moderators, Regional Abroad Moderators Posts: 2,666 Mod ✭✭✭✭TrueDub


    I would always use your second approach, and separate by function. You can then reflect different usages in the sub-package name, if required, or even in the class name.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    The second approach without a doubt.


Advertisement