ingyhere
ingyhere

Reputation: 13861

Output classpath content from within Spring context configuration

Does Spring provide any way to output the actual content of the classpath environment variable when it is loading a resource in a context configuration file?

<!-- Import the special context --> 
<import resource="classpath:mySpecialApplicationContext.xml"/> 

I set the Log4J logging level to ALL for Springframework classes but this value does not appear to be logged by the framework. I am trying to figure out if Spring is loading this from a dependency, and I want to see the classpath setting during application runtime. The application is built by Maven with many dependencies.

If there are two or more mySpecialApplicationContext.xml's in the classpath, which one does Spring use?

Thank you.

Upvotes: 0

Views: 1129

Answers (1)

GreyBeardedGeek
GreyBeardedGeek

Reputation: 30088

You can see the relevant (I think) source code at http://goo.gl/9dK2c

In short:

  1. No, the classpath is not logged

  2. The details of what would be loaded when there is more than one matching resource in the classpath are ClassLoader dependent - the DefaultResourceLoader uses the thread's classloader, but typically, the first one found would be used.

Upvotes: 1

Related Questions