Announcement Announcement Module
Collapse
No announcement yet.
Custom ResourceLoader using the ClasspathXmlApplicationContext Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom ResourceLoader using the ClasspathXmlApplicationContext

    I am looking for a way to create custom ResourceLoader, that will use read from hbase table for the properties.

    I found that i can create my own ApplicationContext, override getResource and use my own ResourceLoader.
    Code:
    	@Override
    	public Resource getResource(String location) {
    		if (location.startsWith(HbaseResource.HBASE_PREFIX) ) {
    			ResourceLoader loader = (ResourceLoader)getBean(HbaseResourceLoader.class);
    			return loader.getResource(location);
    		} else{
    			return super.getResource(location);
    		}
    	}
    I am looking for a way to get the same results, only using ClasspathXmlApplicationContext and not create my own contxt class.
    Lookling at ResourceLoaderAware i see this line:
    As alternative to a ResourcePatternResolver dependency, consider exposing bean properties of type Resource array, populated via pattern Strings with automatic type conversion by the bean factory.
    Can this help me in any way?
    Is there another way i missed to register custom ResourceLoader?
Working...
X