Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Spring MVC Package Structure

  • 14-07-2014 10: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, Paid Member Posts: 2,691 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