Dependent jar not able to locate the resolve a property value from application.yml file

Viewed 41

I have a gradle project which requires two local jars as dependency. I am adding them using fileTree

implementation fileTree(dir: '..//libs', include: '*.jar')

The problem I am facing is , the dependent jar requires a property value from the application.yml file available in the main project. And I am getting this error, even though I have the property available in my application.yml file located in the resources folder.

java.lang.IllegalArgumentException: Could not resolve placeholder 'test.key' in value "${test.key}"

Is there any way to give the property file location to my dependent jar? Or any other ways to make this work?

1 Answers

Found the issue: in my case the lib jar contained spring.components under META-INF dir which messes with the startup of the application.

If you check you classes under @ComponentScan(basePackege= "your-packge") will also be not getting configured because of the above issue.

Use lib without spring application.

Related