简体   繁体   English

Spring MVC项目的strucutre软件包,使用maven进行多个子项目

[英]package strucutre for Spring MVC project with multiple sub projects using maven

Hi we want to create a spring MVC project using maven we want to use just 1 project and under it have multiple sub projects 嗨,我们想使用maven创建一个spring MVC项目,我们只想使用1个项目,并且在其下有多个子项目

what would be a good directory/package structure for the project for example 例如,什么是项目的良好目录/包结构?

com
    company
        subproject_1
            controller
            doa
            service
            entity
        subproject_2
            controller
            dao
            service
            entity

or all files of sub projects in one project 或一个项目中子项目的所有文件

com
    company
            controller
                all controllers of all sub projects 
            doa
                all dao of all sub projects
            service
            entity      

depending on the experience which project structure would be maintainable if the project increases and sub projects keeps adding on 根据经验,如果项目增加而子项目不断增加,哪种项目结构将是可维护的

or suggestion of any other package structure? 或其他包装结构的建议?

also what is the naming standard used for directory is it entity or domain? 还有用于目录的命名标准是实体还是域? doa or persistence? 做还是坚持?

any help and direction toward it will be appreciated 任何帮助和朝着它的方向将不胜感激

Why not following a multi-module project structure to group your sub-projects? 为什么不遵循多模块项目结构将子项目分组? It's a good coding practise widely adopted, recognised and easily manageable. 这是一种被广泛采用,公认且易于管理的良好编码实践。 Have a look at this example . 这个例子

As far as the naming conventions goes that's personal preference but it's good idea to clearly maintain in package structure the different layers as you are saying from botton-top approach: the dao level, the domain , the service layer, the controllers and finally the view . 就命名约定而言,这是个人喜好,但最好在程序包结构中维护您在botton-top方法中所说的不同层: dao层, 服务层, 控制器以及最后的视图

尝试使用添加到工作集选项。

  1. Create maven multimodule project. 创建Maven多模块项目。
  2. In each project two options: 在每个项目中有两个选项:

    • package by feature 按功能包装
    • package by layer 逐层包装

    these options discussed here: http://www.javapractices.com/topic/TopicAction.do?Id=205 这些选项在这里讨论: http : //www.javapractices.com/topic/TopicAction.do?Id=205

My personal approach is to create in each maven module project packages by feature and some "util" packages used by "feature" packages. 我个人的方法是在每个Maven模块中按功能创建项目包,并按“功能”包使用一些“ util”包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM