您当前的位置: 首页 >  ide

程序员一灯

暂无认证

  • 2浏览

    0关注

    152博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Idea创建SpringBoot项目

程序员一灯 发布时间:2021-11-03 12:41:49 ,浏览量:2

一、打开Idea

 

 二、配置

  • 选择Spring Initializr
  • 填写你的项目名称
  • 修改你的项目地址
  • 选择java8,使用jdk1.8版本

 下一步

 点击Finish完成

三、添加SpringMVC模块依赖

 org.springframework.boot
 spring-boot-starter-web
四、添加项目端口
application.properties文件中:
server.port=8888

 五、刷新maven,主动将依赖添加进来

 六、添加rest接口
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @GetMapping("/index")
    public String index(){
        return "index";
    }

}
七、启动项目并请求接口
http://localhost:8888/index

 

关注
打赏
1645367472
查看更多评论
立即登录/注册

微信扫码登录

0.0361s