Home > Java > javaTutorial > body text

Detailed explanation of the method and process of adding a new module in springboot (picture and text)

不言
Release: 2018-11-27 17:00:39
forward
3076 people have browsed it

This article brings you a detailed explanation (pictures and text) of the method and process of adding a new module to springboot. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

In the springboot project framework, there are two major modules of a project, the main project main and the test project test. Our test projects can be further divided according to functions, such as unit tests, integration tests, and business tests. etc.

For a beginner, we need to master the way to build modules. There is not much information on the Internet, and this function is rarely mentioned. Let me popularize it here!

The basic structure of the springboot project is as shown below:

Let’s build an integration test module intTest. Some teams are willing to call it integTest. It’s okay, intTest. This name comes from the official gradle document, and I can also learn from it (https://docs.gradle.org/current/userguide/java_testing.html#test_reporting)

Select file->project structure file -》Project structure, we see that there are two default modules

. Second, close it, then left-click on the test module and select copy, select paste on src, and enter The new module name

Three-select the file to be copied, and then you don’t need to select it here, just create it yourself

##4 If there is a bug in the software, you can still copy the current project file to the new module. In this case, you can delete it and then restore the package again. After that, your intTest package will appear. When the restoration is not successful, it just folder!

5. Open the file structure window. If intTest is not in the same group as main and test, you can move it to the same group.

Sixth, add a java folder to the root project. After creating the folder, you need to modify the folder type, as shown in the figure:

You can configure it for the intTest module The relevant information is also carried out in build.gradle, so I won’t go into details here

Now you should know how to build a multi-module application in springboot!

Note: After you add a new module, if you want to integrate the previous module, you can add the following code in build.gradle (for example, the new module is integTest)

    integTestCompile sourceSets.main.output
    integTestCompile configurations.testCompile
    integTestCompile sourceSets.test.output
    integTestRuntime configurations.testRuntime
Copy after login

In this way, after refreshing, its dependencies will inherit the two modules main and test.

The above is the detailed content of Detailed explanation of the method and process of adding a new module in springboot (picture and text). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template