首页 > 编程语言 > 详细

Spring Boot 使用IntelliJ IDEA创建一个web开发实例(二)

时间:2018-06-10 11:20:43      阅读:216      评论:0      收藏:0      [点我收藏+]

1. 创建一个Controller类 

package com.example.demo;

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

/**
 * Created by Administrator on 2018-06-09.
 */
@RestController
public class DemoController {

    @RequestMapping("hello")
    public String hello(){
        return "hello world!";
    }

}

 

2. 启动应用,右键选中DemoApplication.java,在弹出菜单中选择run或debug

技术分享图片

技术分享图片

3. 输入访问地址 http://localhost:8080/hello

技术分享图片

 

Spring Boot 使用IntelliJ IDEA创建一个web开发实例(二)

原文:https://www.cnblogs.com/zsg88/p/9161766.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!