简体   繁体   English

在 Spring 引导中动态更改 Tomcat 属性

[英]Changing Tomcat properties dynamically in Spring Boot

Generally, I specify Tomcat properties in the application.properties file of my Spring Boot application.通常,我在 Spring 启动应用程序的 application.properties 文件中指定 Tomcat 属性。 Is there any way to change some of those properties (which can be changed) dynamically, in the runtime?有没有办法在运行时动态更改其中一些属性(可以更改)? May be, by hitting an endpoint?可能是,通过击中端点?

If not, is there any other way to make them dynamic from within the application code (and not the properties file)?如果没有,是否有任何其他方法可以从应用程序代码(而不是属性文件)中使它们动态化?

There are some libraries that can be configured both from the application.properties and dynamically as well (using endpoints).有一些库既可以从 application.properties 配置,也可以动态配置(使用端点)。 Does Tomcat provide any such mechanism? Tomcat 是否提供任何此类机制?

Yes, there is.就在这里。 You can configure and hit endpoints to reconfigure:您可以配置并点击端点以重新配置:

https://cloud.spring.io/spring-cloud-config/reference/html/ https://cloud.spring.io/spring-cloud-config/reference/html/

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

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