gpt4 book ai didi

java - 如何重新加载 JSF 使用的 ResourceBundle?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:58:49 25 4
gpt4 key购买 nike

我想在单击按钮时以编程方式重新加载 JSF 使用的 ResourceBundle。类路径中的 ResourceBundle(即 WEB-INF/classes)被外部应用程序修改,修改事件为我所知。

最佳答案

尝试

ResourceBundle.clearCache(Thread.currentThread().getContextClassLoader());

(你可以使用不带参数的相同方法)

来自javadoc

Resource bundle instances created by the getBundle factory methods are cached by default, and the factory methods return the same resource bundle instance multiple times if it has been cached. getBundle clients may clear the cache, manage the lifetime of cached resource bundle instances using time-to-live values, or specify not to cache resource bundle instances. Refer to the descriptions of the getBundle factory method, clearCache, ResourceBundle.Control.getTimeToLive, and ResourceBundle.Control.needsReload for details.

关于java - 如何重新加载 JSF 使用的 ResourceBundle?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2047891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com