新建Springboot项目

软件为sts软件

1.新建项目

2.工程名称

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

 4.添加端口号

5.创建controller

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

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.创建前端文件 ,并输入以下代码

<!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

 

成功创建

maven管理

 

posted @ 2018-01-19 21:37  suwenyuan  阅读(159)  评论(0编辑  收藏  举报