您的位置:首页 > 编程语言 > Java开发

idea创建spring boot项目

2017-11-17 12:00 766 查看
1.打开idea,创建项目



2.选择Spring Initializr,next



3.输入Artifact,Next



4.勾选web(一般情况也就够用了)



5.点击finish



6.项目结构(可以删除”.mvn、mvnw、mvnw.cmd”文件)



7.写一个Hello word程序

不用修改生成的pom.xml文

package com.example;

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

/**
* @Author: yf
* @Date: 2017/11/17.
*/
@RestController
public class HelloController {

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




8.运行程序(默认使用jetty启动)



9.运行结果



在浏览器地址栏输入地址:http://localhost:8080/hello

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring-boot