springBoot是什么?能做什么?
是一个快速开发的脚手架。
作用: 快速创建独立的,生产级的基于spring的应用程序。
特性:
无需部署war文件;
提供starter简化配置;
尽可能自动配置Spring以及第三方库;
提供“生产就绪功能”,如指标,健康检查,外部配置等;
无代码生成,无XML配置;
springboot应用组成分析:
依赖: pom.xml (springboot-maven-plugin)
启动类: 注解
配置: application.properties
static目录: 静态文件
templates目录:模板文件(freemarker,groovy,thymeleaf,mustache)
spirngboot actuator:监控springboot应用程序的。
/actuator/health: 健康检查,检查资源 status{up:正常,down: 不正常,out_of_service:未使用,unkown: 未知}
配置: management.endpoint.health.show-details = always
/actuator/info: 应用描述端口;
配置: info.app-name = xxx;
激活所有的actuator配置:
management.endpoints.web.exposure.indclude= *
常用端点及描述:
conditions 自动配置的信息 对应springboot1.x的 autoconfig
beans 显示程序上下文中所有的spirng bean
configprops 显示所有@ConfigurationProperties的配置属性列表
dump 显示线程活动的快照
env 显示环境变量,包括系统环境变量以及应用环境变量
health 显示应用程序的健康指标
heapdump 堆dump
info 显示应用的信息
loggers 显示日志级别
mappings 显示所有url路径
metrics 显示应用的度量标准信息