1、创建maven工程
2、编写pom.xml文件
要
这三个
3、DemoController.java4.0.0 org.springframework.boot spring-boot-starter-parent2.4.5 com.fzf fzf02-springboot1.0-SNAPSHOT 8 8 org.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-maven-plugin
package com.fzf.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DemoController {
@RequestMapping(value = "/index")
public String index(){
return "hello SpringBoot Web Project";
}
}
4、编写DemoApplication.java
package com.fzf;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class,args);
}
}



