简体   繁体   English

spring-cloud如何使用端点

[英]spring-cloud how to use Endpoints

management endpoints: 管理端点:

For a Spring Boot Actuator application there are some additional management endpoints: 对于Spring Boot Actuator应用程序,还有一些其他管理端点:

    POST to /env to update the Environment and rebind @ConfigurationProperties and log levels

http://localhost:8080/env/testprop it works and returns: http:// localhost:8080 / env / testprop它可以工作并返回:

{
"testprop": "test value"
}

but when I do POST: http://localhost:8080/env/testprop Request method 'POST' not supported 但是当我执行POST时: http:// localhost:8080 / env / testprop请求方法'POST'不支持

I want to update testprop , how to do it with API? 我想更新testprop ,如何使用API​​?

I found the following in the docs 我在文档中找到了以下内容

For a Spring Boot Actuator application there are some additional management endpoints: 对于Spring Boot Actuator应用程序,还有一些其他管理端点:

  • POST to /env to update the Environment and rebind @ConfigurationProperties and log levels POST到/ env以更新环境并重新绑定@ConfigurationProperties和日志级别

  • /refresh for re-loading the boot strap context and refreshing the @RefreshScope beans / refresh用于重新加载引导上下文并刷新@RefreshScope bean

  • /restart for closing the ApplicationContext and restarting it (disabled by default) / restart以关闭ApplicationContext并重新启动它(默认情况下禁用)

  • /pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext) / pause和/ resume调用生命周期方法(ApplicationContext上的stop()和start())

Looks like you have to post agains /env instead of /end/$yourProperty 看来您必须发布筹码/ env而不是/ end / $ yourProperty

Ok, it works: must POST with empty body http://localhost:8080/env/?test=dasda and response is: 好的,它可以正常工作:必须使用空主体http:// localhost:8080 / env /?test = dasda进行POST ,响应为:

{
    "test": "dasda"
}

暂无
暂无

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

相关问题 如何在Spring-Cloud中将ConsulDiscoveryClient与Zuul和Sidecar一起使用 - How do I use the ConsulDiscoveryClient with Zuul and Sidecar in Spring-Cloud 如何让Spring-Cloud Zuul为不同的服务使用不同的电路 - How to get spring-cloud zuul to use a different circuit for different services spring-cloud 和 spring-cloud-gcp 有通用的 BOM 文件吗? - is there common BOM file for spring-cloud and spring-cloud-gcp? 与netflix Eureka一起使用spring-cloud时,如何让Discovery Client工作? - How can I get the Discovery Client working when using spring-cloud together with netflix Eureka? 如何动态添加目录/文件(searchLocations)以供Spring-Cloud配置服务器观看? - How can you dynamically add directories/files (searchLocations) for Spring-Cloud config server to watch? 使用 Spring-Cloud Open Feign,我如何读取另一种类型的嵌套 JSON 数据? - using Spring-Cloud Open Feign, how do i read nested JSON data of another type? Spring-Cloud配置服务器忽略配置属性文件 - Spring-Cloud configuration server ignores configuration properties file 微服务系统中服务之间的分布式事务,使用spring-cloud - Distributed transaction among services in a microservice system, using spring-cloud Springboot 版本从 2.1.6 升级到 2.2.1 和 spring-cloud 问题 - Springboot Version upgrade from 2.1.6 to 2.2.1 and spring-cloud issue spring-cloud bus kafka RemoteApplicationEvent originService 刷新时为 null - spring-cloud bus kafka RemoteApplicationEvent originService is null when refresh
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM