Affects: 4.x, 5.x
In Javadoc of org.springframework.context.support.AbstractResourceBasedMessageSource#setCacheMillis
it says:
Default is "-1", indicating to cache forever (just like java.util.ResourceBundle).
However -1 in java.util.ResourceBundle is TTL_DONT_CACHE and its effect is not cache forever.
It should be TTL_NO_EXPIRATION_CONTROL = -2 to have the cache forever effect.
Hence I think implementation of org.springframework.context.support.ResourceBundleMessageSource#getResourceBundle is inconsistent with java.util.ResourceBundle.
it caches forever for any value less than 0. In order to be consistent with java.util.ResourceBundle it should be as follows
if (getCacheMillis() >= -1) {
return doGetBundle(basename, locale);
}
else {
// Cache forever...
}
and call doGetBundle for TTL_DONT_CACHE = -1 as well.
@jhoeller what do you think about it?
Affects: 4.x, 5.x
In Javadoc of
org.springframework.context.support.AbstractResourceBasedMessageSource#setCacheMillisit says:
However -1 in
java.util.ResourceBundleisTTL_DONT_CACHEand its effect is not cache forever.It should be
TTL_NO_EXPIRATION_CONTROL = -2to have the cache forever effect.Hence I think implementation of
org.springframework.context.support.ResourceBundleMessageSource#getResourceBundleis inconsistent withjava.util.ResourceBundle.it caches forever for any value less than 0. In order to be consistent with
java.util.ResourceBundleit should be as followsand call
doGetBundleforTTL_DONT_CACHE = -1as well.@jhoeller what do you think about it?