springboot整合actuator,进行运维监控

springboot整合actuator,进行运维监控

首先引入依赖:

"1.0" encoding="UTF-8"?>
"http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.1.2.RELEASE
         
    
    com.cxy
    activtiboot
    0.0.1-SNAPSHOT
    activtiboot
    Demo project for Spring Boot

    
        1.8
    

    
        
            org.springframework.boot
            spring-boot-starter-web
        
        
            org.springframework.boot
            spring-boot-starter-actuator
        
        
            org.springframework.boot
            spring-boot-starter-hateoas
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    

二 控制类:

package com.cxy.activtiboot.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * @ClassName: HomeController
 * @Description:
 * @Auther: cxy
 * @Date: 2019/2/15:16:11
 * @version : V1.0
 */
@RestController
public class HomeController {
    @RequestMapping("/get")
    public  String get(){
        return "hellowolrd";
    }
}

三:peizhi;

management.endpoints.web.exposure.include=*

四 启动

package com.cxy.activtiboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ActivtibootApplication {

    public static void main(String[] args) {
        SpringApplication.run(ActivtibootApplication.class, args);
    }

}

运行结果:

http://localhost:8080/actuator

springboot整合actuator,进行运维监控_第1张图片

这些路径是可以点击的,

springboot整合actuator,进行运维监控_第2张图片

 

posted @ 2019-02-15 16:26 动手的程序员 阅读( ...) 评论( ...) 编辑 收藏

你可能感兴趣的:(springboot整合actuator,进行运维监控)