Spring Boot 简介 世界上最好的文档来源自官方的《Spring Boot Reference Guide》,是这样介绍的:
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”…Most Spring Boot applications need very little Spring configuration.
Spring Boot(英文中是“引导”的意思),是用来简化Spring应用的搭建到开发的过程。应用开箱即用,只要通过 “run”(可能是 java -jar 或 tomcat 或 maven插件run 或 shell脚本),就可以启动项目。再就是Spring Boot 只要很少的Spring配置文件(properties,yml)。
因为“习惯优先于配置”的原则,使得Spring Boot在快速开发应用和微服务架构实践中得到广泛应用。
Spring Boot Hello World 创建一个简单SpringBoot项目
next–>finish
项目创建ok!
pom.xml配置 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 <parent > <groupId > org.springframework.boot</groupId > <artifactId > spring-boot-starter-parent</artifactId > <version > 1.5.8.RELEASE</version > <relativePath /> </parent > <properties > <project.build.sourceEncoding > UTF-8</project.build.sourceEncoding > <project.reporting.outputEncoding > UTF-8</project.reporting.outputEncoding > <java.version > 1.8</java.version > </properties > <dependencies > <dependency > <groupId > org.springframework.boot</groupId > <artifactId > spring-boot-starter-web</artifactId > </dependency > <dependency > <groupId > org.springframework.boot</groupId > <artifactId > spring-boot-starter-test</artifactId > <scope > test</scope > </dependency > </dependencies >
controller层 1 2 3 4 5 6 7 @RestController public class TestController { @RequestMapping("hello") public String hello () { return "Hello World!" ; } }
启动应用类 1 2 3 4 5 6 7 8 9 import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication public class Sboot01Application { public static void main (String[] args) { SpringApplication.run(Sboot01Application.class, args); } }
页面访问效果
完成!!