SPRING BOOT快速搭建WEB应用教程(二)—HELLOWORLD

原文地址:http://www.bubblyyi.com/2017/05/04/spring-boot%E5%BF%AB%E9%80%9F%E6%90%AD%E5%BB%BAweb%E5%BA%94%E7%94%A8%E6%95%99%E7%A8%8B%E4%BA%8C-helloworld/


SPRING BOOT快速搭建WEB应用教程(二)—HELLOWORLD

一、创建工程

创建名称为”HelloWorld_SpringBoot”的spring boot工程, new->Spring Starter Project

SpringBoot9
SpringBoot10
勾选需要的业务:
SpringBoot11

二、开始编码

创建HelloController

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package com.BubblyYi.cotroller;
 
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping (value= "/index" )
public class HelloController {
 
     @RequestMapping (value= "/hello"
     public String sayHello(){ 
         return "hello world!"
    
}

启动项目

SpringBoot14

你的控制台会输入这样的信息

当出现  Started HelloWorldSpringBootApplication 字样时表示项目启动成功!
SpringBoot12
我们在浏览器中敲入http://localhost:8080/index/hello 就会出现以下信息。
SpringBoot13
至此呢,第一个HelloWorld web程序就写好啦~~~是不是很方便呢?
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值