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

SpringBoot学习笔记-Eclipse创建SpringBoot项目

2017-07-03 00:00 405 查看
一、首先创建一个maven的web3.0项目。http://blog.csdn.net/u013066244/article/details/53737199

二、修改pom.xml文件,加入spring boot的依赖

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>


三、把hello world程序放进去,从main方法启动。

package hello;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

@Controller
@EnableAutoConfiguration
public class SampleController {

@RequestMapping("/")
@ResponseBody
String home() {
return "Hello World!";
}

public static void main(String[] args) throws Exception {
SpringApplication.run(SampleController.class, args);
}
}


其他链接:

代码和配置文件来自这里: http://projects.spring.io/spring-boot/ 。1.5.4版本。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Spring Boot