繁体   English   中英

spring-cloud如何使用端点

[英]spring-cloud how to use Endpoints

管理端点:

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

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

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

{
"testprop": "test value"
}

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

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

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

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

  • POST到/ env以更新环境并重新绑定@ConfigurationProperties和日志级别

  • / refresh用于重新加载引导上下文并刷新@RefreshScope bean

  • / restart以关闭ApplicationContext并重新启动它(默认情况下禁用)

  • / pause和/ resume调用生命周期方法(ApplicationContext上的stop()和start())

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

好的,它可以正常工作:必须使用空主体http:// localhost:8080 / env /?test = dasda进行POST ,响应为:

{
    "test": "dasda"
}

暂无
暂无

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

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