新建Springboot项目

时间:2025-04-18 15:07:01

软件为sts软件

1.新建项目

新建Springboot项目

2.工程名称

新建Springboot项目

3.选择依赖项,可以在搜索框中搜索

新建Springboot项目

4.添加端口号

新建Springboot项目

5.创建controller

新建Springboot项目

6.创建controller类,并输入一下内容

新建Springboot项目

package com.example.demo.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/")
public class controller {
@Autowired @RequestMapping("")
public String index() {
System.out.println("index");
return "login";
} }

7.创建前端文件 ,并输入以下代码新建Springboot项目

<!DOCTYPE html>
<html>
<head>
<meta charset="BIG5" />
<title>Insert title here</title>
</head>
<body>
hello world!
<p>1231</p>
</body>
</html>

8.在浏览器中输入 http://localhost:8088/ ,因为设置的端口号是8088

新建Springboot项目

成功创建

maven管理

新建Springboot项目