"JAVA applet combat" java aggregation project to build (30)

Done many years of development, the project is a project that a lot of a project, if the dependency files used when other projects directly manually copy over it, since with maven, many open-source projects and Internet companies We are beginning to use maven to build aggregate project to solve the huge problems of individual projects by aggregating the project.

Applet background spring boot to build

  • Single structural engineering
    using Java technology development projects, whether it is data processing system or Web site, with the continuous development of the project, continue to refine and add requirements, the project code more and more, the package structure is also increasingly the more complex this time the progress of the project will encounter a variety of problems:

  1. Mutual coupling between the different aspects of the code, which occur when the cause of the problem is difficult to locate a system problem occurs, even if the target problem is difficult to correct the problem, may introduce additional problems when correcting the problem.


  2. Code set in a wide range of the overall structure, the new into the developer is difficult to have an intuitive feel for the overall project, increasing the cost involved in the development of the novice, there is a need to be familiar with the project developer to maintain the structure of the entire project (usually larger and longer project development time which is hard to do).


  3. Developers very vague code themselves or others responsible for the border, this is the most complex projects likely to encounter, the result is that developers can easily modify the resulting code is responsible for others and responsible people do not know the code, the responsibility to track a lot of trouble .

A complex project split into a plurality of modules is an important method to solve the above problems, a multi-division module may reduce the coupling between the code (up from the class level coupled to the coupling jar package level), each module can be self-explanatory (module by module name or a document), the module also regulate the division of the code boundary, developers can easily determine the content of their responsibility through the module.

  • Maven layered structures using polymeric engineering
    > maven division multiple modules is quite straightforward, each module is a separate item maven, each of the reference solution and the maven jar package depends are consistent between the modules, that the physical (JAR) and is consistent with the logic (dependency).

  1. Establish a parent or root project, equivalent to a basket, basket put other projects.

  2. common 任何枚举类和工作类,好处是所有其他的工程都可以相依赖,跨工程,跨项目来使用是没有问题的。

  3. pojo 所有工程脱离出来的,dao层和service之上的。

  4. mpper(dao)数据层要跟数据库交互的时候需要pojo,所以mpper层要在pojo之上。

  5. service 引入dao 和 pojo类 common引入。

  6. 最后一层是开放层,api 接口层对外开发,可以支持手机端的调用,小程序的调用。web层后台的pc端登录的也要依赖service层。

PS:其实不光是api和web层还有可能有什么文件管理层,权限层等等。都可以通过一层一层调用的方式不断的进行扩张,减少代码很方便。


Guess you like

Origin blog.51cto.com/12040702/2428468