31 lines
807 B
Java
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;
|
|
}
|
|
}
|