Today i got a requirement, where i have to create a common module to expose the version of the application without changing anything in parent application
Common module groupId : com.mhn.version, artifactId: version-endpoint packaging: jar VersionController.java - where i will expose a REST Service "/version" as GET method which returns the details
In any spring boot application if i add this jar (module) as a dependency, then without changing anything in parent application it should fetch the application artifactId and version. Here in this case 1.0.1-SNAPSHOT
For example if i add this as dependency in spring-boot-sample-1.0.1-SNAPSHOT.war application as mentioned in pom.xml below
<groupdId>com.parent.app</groupId>
<artifactId>spring-boot-sample</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.mhn.version</groupId>
<artifactId>version-endpoint</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
Then spring-boot-sample-1.0.1-SNAPSHOT has to expose a service "/version". and by hitting that endpoint it should return maven project.artifactId and project.version details
In this example
{
"artifactId" : "spring-boot-sample"
"version" : "1.0.1-SNAPSHOT"
}
Guide me, if we have any third party jars, if not guide me on how to do this.
Make this as a note, we are not going to do any changes in parent application