Using resources from different bundle

296 Views Asked by At

I have problems with loading files in SpringDM on Virgo. The reason is of course me, I am doing something wrong.

This is the situation: bundleA contains a class to perform some generic initialization (fill tables with data from a generic configuration file).

bundleB contains, among others, a more specific version (extends) of the initialization class from bundleA (in spring file, I also specify that class from bundleA is parent of the more specialized class in bundleB)

bundleC is a web bundle, calls bundleB (which in turns first calls bundleA)

However, bundleB/bundleA does not seem to be able to find the configuration file. I get java.io.FileNotFound exception (file does not exist).

I defined the configuration file in bundleA as a classpath resource:

<bean id="myBeanId" class="org.springframework.core.io.ClassPathResource">
    <constructor-arg>
        <value>configfile.cfg</value>
    </constructor-arg>
</bean>

The bean gets created and injected into the initialization class with Autowired annotation. However, as soon as I try to use the file, I get the exception.

Is there any "general" flaw in my approach? Should I be using other Resource loader? Any other suggestions?

If a part of the question is not clear, let me know, I will try to clarify...

Thanks!

0

There are 0 best solutions below