我的第一个springboot程序

1.进入spring官网,spring.io

springboot学习笔记(二)

springboot学习笔记(二)

springboot学习笔记(二)

springboot学习笔记(二)

 

2.下载完之后,导入STS

springboot学习笔记(二)

3.导入成功之后

springboot学习笔记(二)

目录结构resources:

      1.static:静态文件(图片、音频、js、css)

      2.templates:模板文件(模板引擎freemarker、thymeleaf;springboot默认不支持jsp文件)

      3.application.properties  : 配置文件

运行SpringbootDemoApplication.java即可启动springboot项目

出现以下界面代表启动成功

springboot学习笔记(二)

4.测试

springboot学习笔记(二)

application.properties文件中可以指定tomcat端口,我这里是server.port=8080

创建一个HelloWorldController.java

package com.example.SpringbootDemo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloWorldController {
	@RequestMapping("helloworld")
	@ResponseBody
	public String helloworld() {
		return "helloworld;hello springboot";
	}
}

启动springboot,输入localhost:8080\helloworld,启动chen

springboot学习笔记(二)

自此,我的第一个springboot程序运行成功!

相关文章:

  • 2022-12-23
  • 2021-10-27
  • 2021-10-02
  • 2021-07-10
  • 2022-12-23
  • 2022-01-21
  • 2021-12-24
猜你喜欢
  • 2021-06-09
  • 2021-09-10
  • 2021-11-13
  • 2021-07-08
相关资源
相似解决方案