其实用SpringBoot也有一段时间,主要集中在整合mybatis,redis等等上。
最简单的方式就是去创建一个项目自己体会 http://www.jianshu.com/p/3b477c79acf0
剩下的整合各种资源等等,需要自己去google。
这里面有个监控的jar包,spring-boot-starter-actuator
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
如果在项目中使用spring-boot-starter-actuator,可以使用下面这些路径
HTTP方法 | 路径 | 描述 | 鉴权 |
---|---|---|---|
GET | /autoconfig | 查看自动配置的使用情况 | true |
GET | /configprops | 查看配置属性,包括默认配置 | true |
GET | /beans | 查看bean及其关系列表 | true |
GET | /dump | 打印线程栈 | true |
GET | /env | 查看所有环境变量 | true |
GET | /env/{name} | 查看具体变量值 | true |
GET | /health | 查看应用健康指标 | false |
GET | /info | 查看应用信息 | false |
GET | /mappings | 查看所有url映射 | true |
GET | /metrics | 查看应用基本指标 | true |
GET | /metrics/{name} | 查看具体指标 | true |
POST | /shutdown | 关闭应用 | true |
GET | /trace | 查看基本追踪信息 | true |
例如,在启动项目之后访问http://localhost:8080/health 会出现
UP表示都正常。
如果把redis关掉,那么redis那表示DOWN
Spring Boot的四大神器,分别是auto-configuration、starters、cli、actuator。
自动配置
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
网友评论