public static void main(String[] args) {
ResourceLoader resourceLoader = new DefaultResourceLoader();
ReloadableResourceBundleMessageSource auto = new ReloadableResourceBundleMessageSource();
String[] basenames = {"filename"};
auto.setBasenames(basenames);
auto.setResourceLoader(resourceLoader);
auto.setCacheSeconds(5);
auto.setUseCodeAsDefaultMessage(true);
while(true) {
System.out.println(auto.getMessage("key", null, Locale.CHINESE));
try {
Thread.sleep(5*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
原文地址:http://blog.51cto.com/jtech/2115253