wood burning stoves 2.0*
The moose likes Spring and the fly likes Class path precedence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Class path precedence" Watch "Class path precedence" New topic
Author

Class path precedence

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1381
Whether jar's meta class path ( test.properties ) or Spring <property name="location" value="classpath:/test.properties"/> takes higher precedence ?
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1672
    
    7

I don't understand the question. Higher precedence with what? Give me an example use case.


[How To Ask Questions][Read before you PM me]
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1381
Whether jar's meta class path ( test.properties ) or Spring <property name="location" value="classpath:/test1.properties"/> takes higher precedence ?

Which one loads first ?


Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1672
    
    7

Ok. Repeating the same thing twice and bolding it does not help me understand you any better.

I am going to guess you are building a Spring jar project, and test.properties is part of the project and is being bundled in the JAR. I am guessing this, because you have not told me any more details after I asked for clarification.

This bit here



Looks at the root of your jar for test.properties. There will be only one because otherwise they would overwrite each other as they would have the same name.

I still don't know what you mean by meta class path. If you mean the META-INF directory then you would have to access that property like this:



So there would be no collision.

If you are asking something totally different it sounds like you could easily run a test put different values in each location in your test.properties and see which one gets loaded.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class path precedence