Files
spring-boot-rest/spring-boot-modules/spring-boot-artifacts/src/main/java/com/baeldung/git/CommitInfoController.java
2020-02-11 10:52:06 +05:30

31 lines
807 B
Java

package com.baeldung.git;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
public class CommitInfoController {
@Value("${git.commit.message.short}")
private String commitMessage;
@Value("${git.branch}")
private String branch;
@Value("${git.commit.id}")
private String commitId;
@GetMapping("/commitId")
public Map<String, String> getCommitId() {
Map<String, String> result = new HashMap<>();
result.put("Commit message", commitMessage);
result.put("Commit branch", branch);
result.put("Commit id", commitId);
return result;
}
}