spring boot简介
spring boot是由spring官方推出的一个新框架,对spring进行了高度封装,是spring未来的发展方向。spring boot功用众多,其中最主要的功能就是自动配置,简化开发,下面通过一个hello world来看一下它究竟有多简,需要有一定的spring和maven基础
环境
eclipse:4.5(mars)
jdk:spring4可以兼容jdk1.6,但是spring boot官方公布的一些功能使用1.8性能会高很多,这里使用1.8
创建项目
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
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);
}
}
118



被折叠的 条评论
为什么被折叠?



