欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 幼教 > vscode搭建spring boot项目

vscode搭建spring boot项目

2025/9/23 15:49:41 来源:https://blog.csdn.net/2201_75999403/article/details/148809558  浏览:    关键词:vscode搭建spring boot项目

一.创建项目

第一步:打开vscode按下shift+ctrl+p,选择下面的

第二步:选择版本

第三步:选择语言

第四步:填写项目的Groupid

第五步:填写Artifact id

第六步:选择打包方式

第七步:选择java版本

第八步:选择依赖工具

二.创建项目目录如下:

二.建立HelloController.java内容如下:

package example.example1;import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@CrossOrigin // 允许所有跨域请求(仅用于开发)
public class HelloController {@GetMapping("/hello")public String hello() {return "你好,Spring Boot! 当前时间: " + new java.util.Date();}
}

三.点击主程序(Example1Application.java)点击运行

四.打开浏览器,输入:http://localhost:8080/hello

这样一个简单的spring boot项目就成功部署啦!

版权声明:

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

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