Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class path precedence

 
kri shan
Ranch Hand
Posts: 1462
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether jar's meta class path ( test.properties ) or Spring <property name="location" value="classpath:/test.properties"/> takes higher precedence ?
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand the question. Higher precedence with what? Give me an example use case.
 
kri shan
Ranch Hand
Posts: 1462
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic