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

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

不言
不言forward
2018-11-27 17:00:393009browse

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

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!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete