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

Posted 猪脚踏浪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring Boot 使用IntelliJ IDEA创建一个web开发实例相关的知识,希望对你有一定的参考价值。

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开发实例的主要内容,如果未能解决你的问题,请参考以下文章