From 1fae5622b03093c94f6943d96b51a427765d5a32 Mon Sep 17 00:00:00 2001 From: pared Date: Mon, 22 Aug 2016 19:05:58 +0200 Subject: [PATCH] Commit id plugin (#626) * initial * working * added injection test * [COMMIT-ID-PLUGIN] Add default value for testcheck * pivovarit review refactor * pivovarit review refactor * add logback, log level: INFO * return result in map --- spring-boot/pom.xml | 6 ++++- .../baeldung/git/CommitInfoController.java | 11 ++++++-- .../java/com/baeldung/git/GitInfoDto.java | 25 ------------------- 3 files changed, 14 insertions(+), 28 deletions(-) delete mode 100644 spring-boot/src/main/java/com/baeldung/git/GitInfoDto.java 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; - } -}