1、spring boot 简介
简化spring应用开发的一个框架;
整个spring技术栈的一个大整合;
J2EE开发的的一站式解决方案;
2、微服务
微服务:架构风格(服务微化)
一个应用是一组小型服务,可以通过http的方式进行互通
每个功能元素最终都是一个可以独立替换和独立升级的软件单元
3、环境准备
java
maven
4、helloworld
添加依赖
@SpringBootApplication //主程需注解
5、部署
配置mvn插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
mvn package
java -jar
6、spring-boot-parent详解
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent>
Spring boot 版本中心
7、spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Spring boot 场景启动器(配合版本中心)
8、@SpringbootApplication详解
@java.lang.annotation.Target(value={java.lang.annotation.ElementType.TYPE})
@java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME)
@java.lang.annotation.Documented
@java.lang.annotation.Inherited
@org.springframework.boot.SpringBootConfiguration
@org.springframework.boot.autoconfigure.EnableAutoConfiguration
@org.springframework.context.annotation.ComponentScan(excludeFilters={@org.springframework.context.annotation.ComponentScan.Filter(),@org.springframework.context.annotation.ComponentScan.Filter()
public abstract @interface org.springframework.boot.autoconfigure.SpringBootApplication extends java.lang.annotation.Annotation {
SpringBootConfiguration:spring boot 配置类(配置类也是容器中的一个组件@configure(@component))
EnableAutoConfiguration:开启自动配置(@configure(@import))将springbootApplication所在包及以下所有组件扫描到spring 容器中