点击 File->New->Project 创建新项目:
选择spring Initializr:
点击next 进行下一步:
点击完成之后打开项目:
点击右侧的maven图标,点击同步按钮,下载需要的依赖:
如果下载慢,可以切换maven镜像进行下载
编写Index控制器
package com.example.tioncico.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class IndexController {
@RequestMapping("/index")
public String index(){
return "hello world";
}
}
通过右上角的启动命令,一键编译+启动:
访问 http://localhost:8080/index (默认端口)
启动成功
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有