AgileBootConfig.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package com.agileboot.common.config;
  2. import com.agileboot.common.constant.Constants;
  3. import java.io.File;
  4. import lombok.Data;
  5. import org.springframework.boot.context.properties.ConfigurationProperties;
  6. import org.springframework.stereotype.Component;
  7. /**
  8. * 读取项目相关配置
  9. * TODO 移走 不合适放在这里common包底下
  10. * @author valarchie
  11. */
  12. @Component
  13. @ConfigurationProperties(prefix = "agileboot")
  14. @Data
  15. public class AgileBootConfig {
  16. /**
  17. * 项目名称
  18. */
  19. private String name;
  20. /**
  21. * 版本
  22. */
  23. private String version;
  24. /**
  25. * 版权年份
  26. */
  27. private String copyrightYear;
  28. /**
  29. * 实例演示开关
  30. */
  31. private static boolean demoEnabled;
  32. /**
  33. * 上传路径
  34. */
  35. private static String fileBaseDir;
  36. /**
  37. * 获取地址开关
  38. */
  39. private static boolean addressEnabled;
  40. /**
  41. * 验证码类型
  42. */
  43. private static String captchaType;
  44. /**
  45. * rsa private key 静态属性的注入!! set方法一定不能是static 方法
  46. */
  47. private static String rsaPrivateKey;
  48. private static String apiPrefix;
  49. public static String getFileBaseDir() {
  50. return fileBaseDir;
  51. }
  52. public void setFileBaseDir(String fileBaseDir) {
  53. AgileBootConfig.fileBaseDir = fileBaseDir + File.separator + Constants.RESOURCE_PREFIX;
  54. }
  55. public static String getApiPrefix() {
  56. return apiPrefix;
  57. }
  58. public void setApiPrefix(String apiDocsPathPrefix) {
  59. AgileBootConfig.apiPrefix = apiDocsPathPrefix;
  60. }
  61. public static boolean isAddressEnabled() {
  62. return addressEnabled;
  63. }
  64. public void setAddressEnabled(boolean addressEnabled) {
  65. AgileBootConfig.addressEnabled = addressEnabled;
  66. }
  67. public static String getCaptchaType() {
  68. return captchaType;
  69. }
  70. public void setCaptchaType(String captchaType) {
  71. AgileBootConfig.captchaType = captchaType;
  72. }
  73. public static String getRsaPrivateKey() {
  74. return rsaPrivateKey;
  75. }
  76. public void setRsaPrivateKey(String rsaPrivateKey) {
  77. AgileBootConfig.rsaPrivateKey = rsaPrivateKey;
  78. }
  79. public static boolean isDemoEnabled() {
  80. return demoEnabled;
  81. }
  82. public void setDemoEnabled(boolean demoEnabled) {
  83. AgileBootConfig.demoEnabled = demoEnabled;
  84. }
  85. }