Sam
Sam

Reputation: 6618

Will getMessage for new message force a reload in Spring ReloadableResourceBundleMessageSource?

I can't find this in the documentation:

Suppose I have a ReloadableResourceBundleMessageSource, if I call getMessage() for a property that I just added to the properties file, with another process, will this force a reload, as the property does not exists yet (is not cached), or will this throw an exception?

Do I have to wait for the next cacheRefresh until the property is accessible?

Upvotes: 1

Views: 404

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328624

It will throw an exception until the cache times out. The last modified time stamp of the file is evaluated in refreshProperties() but this happens only after a the cache timeout.

If this is a web application, I suggest to create a web service that calls clearCache(). Your external process can then write new property files and invoke the service to force the refresh in a timely manner.

Upvotes: 2

Related Questions