Skip to content

Refactor ReloadableResourceBundleMessageSource slightly to extend it to read from other file types (json, db)  #30334

Closed
@Sahilshetye

Description

@Sahilshetye

I was hoping to refactor and move this line:
this.cachedProperties.put(filename, propHolder);

from line 461 to line 395

Rationale:
This allows me to extend ReloadableResourceBundleMessageSource and override just refreshProperties() and loadProperties() in the child class to extend reading and loading resources from a different source than .xml or .properties. My use case requires me to use JSON or db query

@Override
protected PropertiesHolder refreshProperties(String filename, @Nullable PropertiesHolder propHolder){
    PropertiesHolder prop = super.refreshProperties(filename, propHolder);
    if (propHolder.getProperties().isEmpty()){
        //try refreshing as json. since XML and  prop are not present)
    }
}

And This Class has a lot of useful reload logic which is pointless to reimplement if the functionality is already present.

Metadata

Metadata

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: supersededAn issue that has been superseded by another

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions