1 概念
官网上的解释:
Features
Create stand-alone Spring applications
Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
Provide opinionated 'starter' POMs to simplify your Maven configuration
Automatically configure Spring whenever possible
Provide production-ready features such as metrics, health checks and externalized configuration
Absolutely no code generation and no requirement for XML configuration
能够创建独立的spring应用
内置了Tomcat, Jetty or Undertow这些服务器,也不需要部署war文件,也就是不需要web.xml
提供了一系列的starter poms(依赖)来简化maven的配置(依赖有:
http://blog.youkuaiyun.com/whatlookingfor/article/details/51393398)
自动配置spring
提供了一些生产环境的特性,比如metrics, health checks and externalized configuration
绝对没有代码生成和XML配置要求
2 快速搭建一个springboot 的框架
POM.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>springboot-framework</groupId>
<artifactId>springboot-framework</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>springboot框架搭建,实现与mybatis整合</description>
<!--spring-boot-starter-parent这个依赖提供了很多依赖的版本-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<properties>
<java.version>1.7</java.version>
<mybatis-spring-boot>1.2.0</mybatis-spring-boot>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
<properties>
<java.version>1.7</java.version>
<mybatis-spring-boot>1.2.0</mybatis-spring-boot>
</properties>
这个配置是由于在parent的POM包里面,配置了java.version(jdk的版本),如图: