STS springboot be built on to the multi-module Maven

Construction of STS based on multi-module springboot

Recently someone wanted to build a multi-module springboot framework of reference to some open-source framework for building and some of the blog. We compiled some steps on building the springboot:
The following is what I've built multi-module basis directory was created:
Here Insert Picture Description
to build a main project called gctime of, gctime-admin, gctime-framework for the program to start gctime sub-project, gctime-admin of entrance, gctime-framework for the entire configuration of the project.

2 First

2.1, create a new project SpringStarterProject

File-> New-> Spring Starter Project
Here Insert Picture Description
Filling is completed, click next, after the default configuration, it has been next, Finish.
The last project structure below:
Here Insert Picture Description
The project will serve as the parent project, carried out at this time temporarily change the project structure, only the pom.xml in a packaging change pom

2.2, create various sub-module project

In the main project right -> maven-> New Maven Module Project
Here Insert Picture Description
Click Finish to create, refresh the project is completed, there will be two projects, the parent project contains a model sub-projects.
According to the above steps, according to their requirements create good submodules, such as admin, framework, and finally the overall structure shown below:
Here Insert Picture Description

2.3, change the directory structure of the project

Someone is admin as the program entry, the framework configured as a collective project, you need only to provide external access to admin, so will gctime main project start classes GctimeApplication.java and other configuration files to application.properties to admin directory.
After the move is complete structure as shown below:
Here Insert Picture Description
The gctime in excess of directory clear, gctime do not need to write code, after finishing the project architecture as shown below:
Here Insert Picture Description

2.4, complete rewrite pom file dependencies

Modify the pom file gctime-admin in the middle:
Here Insert Picture Description
modified gctime-framework of pom file:
Here Insert Picture Description
the main project is not modified.

test

Create a test class test:
Here Insert Picture Description
After the above work is done, a preliminary simple interface service project is complete,

Right-run web projects, and access to the browser, access path is as follows:

http: // localhost: 8081 / hello
Here Insert Picture Description
These are simple to construct a building on springboot sts of multi-module, if someone needs to build a more diverse, such as adding: Integrated mybatis, logging tools, Shiro, need to master Engineering and configure the framework, a reference to the future of sub-modules.

Digression:
Recently someone wanted too complex, resulting in slow efficiency, the need to review their own, easy to difficult to know, not forgetting the beginning of the heart.

Published 30 original articles · won praise 8 · views 20000 +

Guess you like

Origin blog.csdn.net/wg22222222/article/details/84768625