【问题标题】:Creating two read custom actuator endpoint创建两个读取自定义执行器端点
【发布时间】:2021-07-05 13:23:10
【问题描述】:

有没有办法创建多个 GET 自定义执行器端点?

希望有如下网址:

执行器/功能/主动

执行器/功能/状态

@Component
@Endpoint(id = "features")
public class FeaturesEndpoint {

    @ReadOperation
    public boolean isActive() {
        return true;
    }

/* Second read endpoint that is needed:
  @ReadOperation
    public boolean getStatus() {
        return true;
    }
*/
}

【问题讨论】:

    标签: java spring spring-boot spring-mvc


    【解决方案1】:

    你可以试试这个:

    @RestController
    @RequestMapping("/actuator/features")
    public class FeaturesEndpoint {
    
      @GetMapping("/active")
      public boolean isActive() {
        return true;
      }
    
    
      @GetMapping("/status")
      public boolean getStatus() {
        return true;
      }
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      • 2018-08-12
      • 2018-09-16
      • 1970-01-01
      相关资源
      最近更新 更多