Preface
Based on the lion project we have created, using spring boot, we can start the project with very few configurations. I won’t say much below, let’s take a look at the detailed introduction together.
The method is as follows:
1. Introduce Spring boot, we open the pom file of the lion parent module and inherit the pom of spring boot
2 Let the lion-web module depend on the web-related jar package of spring boot, open the pom file under the lion-web project, and add the following dependencies
3 Add spring boot entry startup class Application.java. This class needs to be in the lion-web module. The general location is as shown in the figure below
The code is as follows:
4 Create a controller, the location is as shown in the DemoController in the figure above
5 Run the Application class to start the project
In the Application.java class, right-click Run as and Java Application, just like we usually start a main method, it will be OK.
When you see LION IS READY, the project will be successfully started. You can also see that the built-in tomcat-started http port is on 8080.
6 Test the http interface we exposed in DemoController
At this point, a simple multi-module project built through maven can easily start the project after we introduce spring boot-related dependencies and easily create the http interface we need, with few dependencies and simple configuration.
Summarize
The above is the entire content of this article. I hope that the content of this article has certain reference value for everyone's study or work. If you have any questions, you can leave a message to communicate. Thank you for your support to Wulin.com.