关于java:spring-cloud如何使用端点

spring-cloud how to use Endpoints

管理端点:

对于Spring Boot Actuator应用程序,还有一些其他管理端点:

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

http:// localhost:8080 / env / testprop它可以正常工作并返回:

1
2
3
{
"testprop":"test value"
}

但是当我执行POST时:http:// localhost:8080 / env / testprop
请求方法" POST"不支持

我想更新testprop,如何使用API?


我在文档中找到了以下内容

For a Spring Boot Actuator application there are some additional management endpoints:

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

  • /refresh for re-loading the boot strap context and refreshing the @RefreshScope beans

  • /restart for closing the ApplicationContext and restarting it (disabled by default)

  • /pause and /resume for calling the Lifecycle methods (stop() and start() on the ApplicationContext)

看起来您必须发布筹码/ env而不是/ end / $ yourProperty


好的,它可以工作:
必须张贴空身体
http:// localhost:8080 / env /?test = dasda
响应是:

1
2
3
{
   "test":"dasda"
}