Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:32:10+00:00 2026-06-17T06:32:10+00:00

I am looking for a way to create custom ResourceLoader, that will use read

  • 0

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.

@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’m looking for a way to get the same results, only using ClasspathXmlApplicationContext and not create my own contxt class.
Reading about 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:32:11+00:00Added an answer on June 17, 2026 at 6:32 am

    ResourceLoader is kind of a special building block and can’t be directly injected like some other container services, but I believe your observation on the type conversion can help. You can install a ConversionService (with bean name “conversionService”) with some capabilities that suit you, and if you can make sure that it gets registered before any conversion needs to take place then I think it will work. How you do that depends on whether you use XML or @Configuration probably. A simple toy example:

    @Test
    public void testResource() {
        System.setProperty("value", "123");
        System.setProperty("resource", "location:not.found");
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(TestConfig.class);
        context.refresh();
        Resource resource = context.getBean("resource", Resource.class);
        assertTrue(resource.exists());
    }
    
    @Configuration
    @Import(ConversionConfig.class)
    public static class TestConfig {
    
        @Value("${resource}")
        private Resource resource;
    
        @Bean
        public Resource resource() {
            return resource;
        }
    
        @Bean
        public static PropertySourcesPlaceholderConfigurer placeholders() {
            return new PropertySourcesPlaceholderConfigurer();
        }
    
    }
    
    @Configuration
    public static class ConversionConfig {
    
        @Bean
        protected ConversionService conversionService(final ResourceLoader loader) {
            GenericConversionService service = new GenericConversionService();
            service.addConverter(new Converter<String, Resource>() {
                public Resource convert(String location) {
                    Resource resource = loader.getResource(location);
                    if (resource.exists()) {
                        return resource;
                    }
                    return new ByteArrayResource("foo".getBytes());
                }
            });
            return service;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to create a custom version of UpdateSourceTrigger that I can use with
I'm looking for a way to create a function that can be used in
In a custom list, is there any way to create a column that will
I'm looking for the best way to create a custom border around an HTML
I am looking for a way to create figure that contains several subplots which
I am looking for a way to create a program in unmanaged c++ that
I am new in pygtk. I am looking a way how to create custom
I'm looking for a way to create custom events on Titanium. In order to
Looking for some help on the best way to create a custom UIActivityIndicator. I
I'm looking for a way to create a Boost.Fusion sequence wrapper that is itself

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.