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 7571781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:45:18+00:00 2026-05-30T15:45:18+00:00

I am trying to write a framework where plugins can be dynamically loaded. One

  • 0

I am trying to write a framework where plugins can be dynamically loaded. One step in this loading process is to load in a properties file “properties.plugin” I would like to load this into a PropertyPlaceholderConfigurer however it appears that this uses a different Classloader than the one the GenericApplicationContext has been set to use.

My code for creating the context:

GenericApplicationContext ctx = new GenericApplicationContext();
    if(classLoader !=null)
        ctx.setClassLoader(classLoader);
    ctx.getDefaultListableBeanFactory().setAllowBeanDefinitionOverriding(false);

    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
    xmlReader.setBeanClassLoader(classLoader);
    int totalBeanCount = 0;
    List<Resource> processedResources = new ArrayList<Resource>(resources.length);
    for(Resource r:resources)
    {
        try
        {
            int loadedBeanCount = xmlReader.loadBeanDefinitions(r);
            totalBeanCount += loadedBeanCount;
            processedResources.add(r);

        }
        catch(BeanDefinitionStoreException e)
        {

            throw e;
        }
    }

classLoader in the above code gets set at start up.

The bean is setup as follows:

<bean name="ReloadedPropertiesPlaceholderConfigurer" class="myProject.MyPropertyPlaceholderConfigurer" >
    <property name="locationNames" ref="locationNamesList" />
    <property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>

<bean name="locationNamesList" class="java.util.ArrayList">
    <constructor-arg>
        <list>
            <value>properties/properties.plugin</value>
        </list>
    </constructor-arg>
</bean>

myProject.MyPropertyPlaceholderConfigurer simply extends PropertyPlaceholderConfigurer

When I call ctx.refresh() later in the code i see a log message saying could not find properties/properties.plugin

The following code

classLoader.getResource("properties/properties.plugin");

Works if i add it just before setting the class loader on the context.

I have also tried classpath:properties/properties.plugin, properties.plugin, classpath*:properties.plugin.

Is it the case that this PropertyPlaceholderConfigurer is using a different classloader than the one set on ctx and if so is there a way to set the class loader it uses?

I don’t see a setClassLoader method.

  • 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-05-30T15:45:19+00:00Added an answer on May 30, 2026 at 3:45 pm
     Thread.currentThread().setContextClassLoader(classLoader);
    

    Seems to make it work so it must be using this class loader instead of the one set on the context.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a soap extension. But the framework is not loading it.
What exception is thrown in the .NET Framework when trying to write a file
As an experiment I'm trying to write a generic MVP framework. I started with:
Trying to write a couple of functions that will encrypt or decrypt a file
Im trying to write a single byte at a certain location in a file.
I am currently trying to write some unit test against my zend framework controller.
I'm trying to write a generic repository for my Entity Framework based application. Here's
I am trying to write a generic one-size-fits-most repository pattern template class for an
This is the code for Spyder1 that I've been trying to write within Scrapy
I am trying to write my own Javascript Framework something like jQuery. I use

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.