We are using Spring-boot to build micro-services. In my project set-up we have a common maven module named platform-boot with main class with annotation SpringBootApplication
If we want to create a new micro-service (say Service-1), we simply add a dependency of platform-boot module and provide the main-class path in pom.xml and we are good to go.
Problem is when I try to read Manifest.MF file of Service-1 by writing code in my 'main-class' in dependent module. It reads the Manifest.MF file of platform-boot.
Below is the code snippet of how I am reading Manifest.MF file in my main class.
MyMain.class.getProtectionDomain().getCodeSource().getLocation().getPath();
//Returns the path of MyMain.class which is nested jar
Please suggest a way to read the Manifest.MF file of Service-1.
PS: I want to read the Maifest.MF file to get Implementation-Version. Please suggest if any other way of getting it as well.