spring boot application.yml 属性在运行时发生变化 [英] spring boot application.yml properties change at runtime

查看:48
本文介绍了spring boot application.yml 属性在运行时发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Spring Boot 应用程序中,我能够使用 @ConfigurationProperties 注释将 application.yml 中的属性绑定到 bean 字段.

In a spring boot application, I am able to bind properties from application.yml to the bean fields using @ConfigurationProperties annotation.

是否可以在运行时更新 application.yml 中的这些属性并使其反映在 bean 中?如果是的话.如何做到这一点?

Is it possible to update these properties in application.yml at runtime and get them reflected in the bean? If yes. How to do this?

过去,我使用 ReloadableResourceBundleMessageSource

In the past, I've gotten this working using ReloadableResourceBundleMessageSource

推荐答案

SpringCloud Config 可以做到这一点,而且还不止于此.特别是,检查示例应用程序.

这篇关于spring boot application.yml 属性在运行时发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆