zoukankan      html  css  js  c++  java
  • springboot整合actuator,进行运维监控

    首先引入依赖:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="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">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.1.2.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.cxy</groupId>
        <artifactId>activtiboot</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>activtiboot</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-hateoas</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    </project>

    二 控制类:

    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

    这些路径是可以点击的,

  • 相关阅读:
    Struts2.5 利用Ajax将json数据传值到JSP
    io/nio
    Elasticsearch 、 Logstash以及Kibana 分布式日志
    zookeeper
    mybatis
    Kubemetes
    线程池
    @Builder
    jdk命令行工具系列
    什么是分布式事务
  • 原文地址:https://www.cnblogs.com/xiufengchen/p/10384318.html
Copyright © 2011-2022 走看看