SpringBoot笔记--事件监听+启动流程+监控+项目部署
事件监听
ApplicationContextInitializer
SpringApplicationRunListener
ApplicationRunner
CommandLineRunner
启动流程
监控--自带监控插件(Actuator)
info和health的属性:
localhost:8080/actuator/info
info里面的值在.properties文件或者是.yml文件或者是.yaml文件中获取
而对于健康检查的相关信息的开启,也是同上:localhost:8080/actuator/health
想要获取到健康检查的完整信息,需要在配置文件里面写上这么一段话:
management.endpoint.health.show-details=always(本来默认是never)
actuator开启所有的endpoint
暴露所有的endpoints
相关语句:management.endpoints.web.exposure.include=*
Spring Boot Admin图形化界面
首先,导入依赖坐标
然后,在.properties文件里面指定admin.server地址
之后就分别运行两个模块,在网页里面访问的话,直接使用localhost:端口号访问即可
项目部署
默认打的包为jar包(内部访问)
找到Maven Projects里面的package选项:
点击即打包成功
运行的话,不用像外部打包那样加一个springboot目录,直接user/findall访问
若是要将打包方式更改为war(外部访问)
首先,需要在pom.xml文件里面加上这样的代码:
然后,将Spring执行文件做如下更改:
然后执行
访问网页内容