当前位置: 首页> 汽车> 车展 > SpringBootWeb快速入门

SpringBootWeb快速入门

时间:2025/8/23 5:09:15来源:https://blog.csdn.net/qq_43494013/article/details/141308441 浏览次数: 0次

步骤:

  1. 创建springboot工程,并勾选web开发相关依赖
  2. 定义HelloController类,添加方法hello,并添加注解
  3. 运行测试

具体如下:
在这里插入图片描述

在这里插入图片描述

编写HelloController类:

package com.example.springbootwebquickstart;import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;// 请求处理类
@RestController
public class HelloController {@RequestMapping("/hello")public String hello() {System.out.println("Hello World");return "Hello World ";}}

启动SpringBoot
在这里插入图片描述

访问8080
在这里插入图片描述

关键字:SpringBootWeb快速入门

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: