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 all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

Spring MVC Package Structure

Options
  • 14-07-2014 10:10am
    #1
    Registered Users 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,638 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 Posts: 2,021 ✭✭✭ChRoMe


    The second approach without a doubt.


Advertisement