GitUtil.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package com.genersoft.iot.vmp.utils;
  2. import org.springframework.beans.factory.annotation.Value;
  3. import org.springframework.context.annotation.PropertySource;
  4. import org.springframework.stereotype.Component;
  5. /**
  6. * 一个优秀的颓废程序猿(CSDN)
  7. */
  8. @Component
  9. @PropertySource(value = {"classpath:git.properties" }, ignoreResourceNotFound = true)
  10. public class GitUtil {
  11. @Value("${git.branch:}")
  12. private String branch;
  13. @Value("${git.commit.id:}")
  14. private String gitCommitId;
  15. @Value("${git.remote.origin.url:}")
  16. private String gitUrl;
  17. @Value("${git.build.time:}")
  18. private String buildDate;
  19. @Value("${git.build.version:}")
  20. private String buildVersion;
  21. @Value("${git.commit.id.abbrev:}")
  22. private String commitIdShort;
  23. @Value("${git.commit.time:}")
  24. private String commitTime;
  25. public String getGitCommitId() {
  26. return gitCommitId;
  27. }
  28. public String getBranch() {
  29. return branch;
  30. }
  31. public String getGitUrl() {
  32. return gitUrl;
  33. }
  34. public String getBuildDate() {
  35. return buildDate;
  36. }
  37. public String getCommitIdShort() {
  38. return commitIdShort;
  39. }
  40. public String getBuildVersion() {
  41. return buildVersion;
  42. }
  43. public String getCommitTime() {
  44. return commitTime;
  45. }
  46. }