如何在application.properties中更改属性?

huangapple 未分类评论53阅读模式
英文:

How can i change properties in application.properties?

问题

有人能否提供任何方法,以便在应用程序启动时更改application.properties中的属性?在应用程序启动时,我可以从数据库中接收一些属性,这些属性应该覆盖文件中相应的属性。我的目标是在应用程序启动时只更改它们一次... 我该如何实现这一点?

英文:

Could anyone advice any way how the properties in application.properties can be changed on application startup? On application start i can receive some propertied from DB that should override my appropriate properties at file. My goal is tho change them only once on app start...
How can i achieve this?

答案1

得分: 0

为什么不为这个程序创建一个启动器?启动器将负责定位和使用适当的属性。因此,当启动器程序启动时,您将通过数据库连接检查新属性,将属性安装在适当的位置,然后启动您的真实程序。

英文:

Why don't you create a launcher for the program ? It will be the launcher responsibility to locate and use appropriate properties ? So when the launcher program starts you will check via DB connection for new properties install the properties on the appropriate location and then launch your real program.

huangapple
  • 本文由 发表于 2020年4月3日 22:53:51
  • 转载请务必保留本文链接:https://java.coder-hub.com/61014596.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定