使用Maven构建Spring Boot 第一课之Hello world 程序

Spring Boot 学习第一课

官网
https://spring.io/

学习手册
https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/

入门指南
https://spring.io/guides/gs/spring-boot/

准备开始

获取模板源码

可选以下三种方式 Optional

  1. git clone https://github.com/spring-guides/gs-spring-boot.git
  2. https://github.com/spring-guides/gs-spring-boot/archive/master.zip
  3. https://start.spring.io/

使用Intellij IDEA 开发指南

  1. 运行Intellij IDEA,点击 ’ Create New Project ’

这里写图片描述

2.如图所示:

这里写图片描述

3.如图所示:

这里写图片描述

4.如图所示:
这里写图片描述

5.如图所示:

这里写图片描述

6.点击Finish之后可以看到如下所示:

这里写图片描述

7.点击运行后可以看到这样的界面:

http://127.0.0.1:8080

这里写图片描述

8.创建一个叫做HelloController的java 类

这里写图片描述

package com.xingyun.springbootwithmavensample;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@RestController
public class HelloController {
  @RequestMapping(value =/hi",method = RequestMethod.GET)            
  public String index(){
       return "Hello World , Spring Boot";
  }
 }

重新运行,打开链接:http://127.0.0.1:8080/hi

这里写图片描述

源码下载地址:https://gitee.com/xingyuncode/SpringBootWithMavenSample

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

极客星云

谢谢认可,希望对你的学习有帮助

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值