Development environment:
Prerequisites: The above software has been installed and the environment variables of jdk and maven are configured
Create steps:
Click on the corner file ---》Select new ---》Click project... As shown in the figure below:
Click Spring Initializr on the left ---》 Create a new jdk in the upper right corner (if there is, it is not necessary) ---》 Click next as shown in the following figure:
Click next (you can use the default directly)
Click on the Web on the left ---》 Select the Web on the middle column ---》 Click next as shown in the figure below:
Enter the project name and save path--- 》Click finish
The created project is shown in the figure below:
Create the HelloController class, the code looks like this:
package com.example.demo.controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestController@RequestMapping("/hello")public class HelloController { @RequestMapping("/say")public String saysHello() { return "hello world"; }}After executing the main method in DemoApplication, visit the http://localhost:8080/hello/say page as follows:
Summarize
The above is a graphic tutorial on the creation of spring-boot project by Intellij IDEA that the editor introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message. The editor will reply to you in time!