springboot series 1 quickly create Hello World

1. Environmental preparation

  • jdk
  • maven
  • idea

2. Open IDEA

1. New project

Insert picture description here

2. Select Spring Initializr

Insert picture description here

3. Configure project properties

  • project name
  • Package name
    Java version select the version corresponding to your computer
    Insert picture description here

4. Select Spring Web Components

Insert picture description here

5. Write Controller

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @GetMapping("hello")
    public String hello(){
        return "hello world!";
    }
}


6. Run the project and visit in the browser

Run xxxApplication (xxx is the name corresponding to your own project)
Insert picture description here

Guess you like

Origin blog.csdn.net/dabaoting/article/details/114012848