Reputation: 204
I like to access a property file in a jar. There is foo.jar, which is place in boo.war. In a fooClass class, which inside foo.jar , a variable refer to a properties file place in jar, which was injected using spring.
<util:properties id="name" location="classpath:\foo-Needed.properties"/>
When the war is placed in server and started, java.lang.NullPointerException
is thorwn while access the properties.
fooClass will be initiated on the server startup.
ANy suggestion to solve this? this might look silly, but I'm new to this.
Thanks in advance.
Upvotes: 0
Views: 495
Reputation: 204
this worked
<util:properties id="name" location="classpath\*:/foo-Needed.properties"/>
Upvotes: 0
Reputation: 2137
to scan the full classpath, instead of the most direct classpath, you can format the reference to it as such classpath*:/foo-Needed.properties
.
so, in this case, it would look like
<util:properties id="name" location="classpath*:/foo-Needed.properties"/>
Upvotes: 1