I have following springboot application
Parent
— ReportAnalytics which has the main method
— diffToolv1 (has getDifference REST api end point) : dependency on jar1
— diffToolv2 (has getDifferenceV2 REST api end point) : dependency on jar2
jar1 and jar2 both have a package inspector
.
Now when I am calling a method in diffToolv1, it is referring to class of inspector
package from jar2. This might be because when springboot is initialized, jar2 is loaded before jar1.
I cannot modify package name in the dependencies.
What are my options?
**Things which I tried:
**
chatgpt gave different strategies but those would not work. Here is the list:
- Classpath Ordering: I want both jars in classpath
- Exclude or Remove Conflicting JAR: Same as above
- Use Fully Qualified Class Names: I wish I could use jar names in import statements
- Custom Classloader: Both the jars need to be loaded. So I am not sure.
- Rename Packages: They are not my packages. I can’t modify them.
- Debugging: I have verified that jar2 classes are getting called from diffToolv1.