SpringCloud通过heath与info进行监控程序的运行情况与项目配置

前面写了服务提供者与服务消费者,接下来说对每个项目进行监控

SpringBoot提供了很多的监控,可以使用http://ip:端口/监控方式,进行监控,首先我们在之前完成的服务消费者(provider-user)与服务提供者(provider-consumer)中的pom文件中添加依赖


		
			org.springframework.boot
			spring-boot-starter-actuator
		

然后就可以通过health的方式查询相关的运行情况,启动两个项目

然后可以通过相应的端口进行监控每个项目的情况

SpringCloud通过heath与info进行监控程序的运行情况与项目配置_第1张图片

SpringCloud通过heath与info进行监控程序的运行情况与项目配置_第2张图片

通过info查询需要对其进行配置

application.properties,我们在两个项目上都加上这个info的配置

#mybatis扫描路径
mybatis.type-aliases-package=com.lyl.cloud.entity

#mysql连接配置
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/cloud?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root

#springMVC配置
spring.mvc.view.prefix=classpath:/templates/*
	
#配置端口
server.port=8000

#项目配置说明,通过http://ip(localhost):端口(8000)/info进行查询
[email protected]@
info.app.encoding:@project.build.sourceEncoding@
info.app.java.source:@java.version@
info.app.java.target:@java.version@

浏览器查看

SpringCloud通过heath与info进行监控程序的运行情况与项目配置_第3张图片

SpringCloud通过heath与info进行监控程序的运行情况与项目配置_第4张图片

 

你可能感兴趣的:(SpringCloud通过heath与info进行监控程序的运行情况与项目配置)