diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 66197feacd..dcf9c22175 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -126,7 +126,11 @@ true - + + ${project.build.outputDirectory}/git.properties + + + diff --git a/spring-boot/src/main/java/com/baeldung/git/CommitInfoController.java b/spring-boot/src/main/java/com/baeldung/git/CommitInfoController.java index 226ba44dd5..1da2bd2989 100644 --- a/spring-boot/src/main/java/com/baeldung/git/CommitInfoController.java +++ b/spring-boot/src/main/java/com/baeldung/git/CommitInfoController.java @@ -4,6 +4,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.HashMap; +import java.util.Map; + @RestController public class CommitInfoController { @@ -17,7 +20,11 @@ public class CommitInfoController { private String commitId; @RequestMapping("/commitId") - public GitInfoDto getCommitId() { - return new GitInfoDto(commitMessage, branch, commitId); + public Map getCommitId() { + Map result = new HashMap<>(); + result.put("Commit message",commitMessage); + result.put("Commit branch", branch); + result.put("Commit id", commitId); + return result; } } diff --git a/spring-boot/src/main/java/com/baeldung/git/GitInfoDto.java b/spring-boot/src/main/java/com/baeldung/git/GitInfoDto.java deleted file mode 100644 index b8b58f55e8..0000000000 --- a/spring-boot/src/main/java/com/baeldung/git/GitInfoDto.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.git; - -public class GitInfoDto { - private String commitMessage; - private String branch; - private String commitId; - - public GitInfoDto(String commitMessage, String branch, String commitId) { - this.commitMessage = commitMessage; - this.branch = branch; - this.commitId = commitId; - } - - public String getCommitMessage() { - return commitMessage; - } - - public String getBranch() { - return branch; - } - - public String getCommitId() { - return commitId; - } -}