简体   繁体   English

你如何使用 Spring 引导执行器,仅在非 Web 上使用 JMX spring 引导应用程序

[英]How do you use Spring Boot Actuator using JMX only on a non-web spring boot app

I am trying to create a stand alone GRPC server but with Spring Boot so I get DI and other things that are provided by Spring Boot.我正在尝试创建一个独立的 GRPC 服务器,但使用 Spring 引导,所以我得到了 DI 和 Spring 引导提供的其他东西。 What I am trying to do is implement the health check endpoint via JMX but when I run it with the following dependendices (note I commented out webflux because I don't want the webflux engine)我想要做的是通过 JMX 实现健康检查端点,但是当我使用以下依赖项运行它时(注意我注释掉了 webflux,因为我不想要 webflux 引擎)

    runtimeOnly 'org.springframework.boot:spring-boot-starter-actuator'
//  implementation 'org.springframework.boot:spring-boot-starter-webflux'
    implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'

My application yaml is我的应用程序 yaml 是

spring:
  main:
    banner-mode: "off"
    web-application-type: none
management:
  endpoint:
    health:
      enabled: true
  endpoints:
    jmx:
      exposure:
        include: health

When I go to jconsole locally I don't see any of the spring boot mbeans though.当我 go 到 jconsole 本地时,我没有看到任何 spring 引导 mbean。

I tried to spring.application.admin.enabled: true and spring.jmx.enabled: true with no luck我试图spring.application.admin.enabled: truespring.jmx.enabled: true没有运气

Actually it was one of my attempts that just didn't start up correctly.实际上,这是我的尝试之一,只是没有正确启动。 The value to enable it is spring.jmx.enabled so the YAML stanza would be.启用它的值是spring.jmx.enabled因此 YAML 节将是。

spring:
  main:
    banner-mode: "off"
    web-application-type: none
  jmx:
    enabled: true
management:
  endpoint:
    health:
      enabled: true
  endpoints:
    jmx:
      exposure:
        include: health

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM