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

使用Intellij IDEA创建SpringBoot项目

2017-12-06 14:45 686 查看
本文介绍如何通过Intellij IDEA创建SpringBoot项目

1、点击Create New Project



2、选择Spring Initialzr,点击Next



3、设置Group、Artifact、Language等信息,点击Next



4、选择依赖,我们先选择Web依赖即可,点击Next



5、命名项目,点击Finish完成



6、修改DemoApplication如下

package com.springboot.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableAutoConfiguration
public class DemoApplication {
@RequestMapping("/")
String home() {
return "Hello World!";
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}


7、启动应用



8、在浏览器输入http://localhost:8080/

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