Spring Boot | 使用Spring Initializr快速创建
简单快速搭建启动Spring Boot项目
-
Create New Prject | 创建新项目
-
选择 Spring Initializr
-
填好信息选择下一步
-
可以选择一些工具
-
创建好后项目会开始初始化,等待一下
-
修改启动类
SpringBootSiApplication
package com.cyinfotech.springbootsi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class SpringBootSiApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootSiApplication.class, args);
}
@RequestMapping("/")
public String getIndex () {
return "Hello Spring Boot";
}
}
-
初始化完成后右上角启动|调试项目
-
启动信息
-
页面访问 ‘http://localhost:8080/’