提交 | 用户 | 时间
|
722af2
|
1 |
package com.dl.common.config; |
X |
2 |
|
|
3 |
import lombok.Data; |
|
4 |
import lombok.Getter; |
|
5 |
import org.springframework.boot.context.properties.ConfigurationProperties; |
|
6 |
import org.springframework.stereotype.Component; |
|
7 |
|
|
8 |
/** |
|
9 |
* 读取项目相关配置 |
|
10 |
* |
|
11 |
* @author Lion Li |
|
12 |
*/ |
|
13 |
|
|
14 |
@Data |
|
15 |
@Component |
|
16 |
@ConfigurationProperties(prefix = "dl") |
|
17 |
public class DLConfig { |
|
18 |
|
|
19 |
/** |
|
20 |
* 项目名称 |
|
21 |
*/ |
|
22 |
private String name; |
|
23 |
|
|
24 |
/** |
|
25 |
* 版本 |
|
26 |
*/ |
|
27 |
private String version; |
|
28 |
|
|
29 |
/** |
|
30 |
* 版权年份 |
|
31 |
*/ |
|
32 |
private String copyrightYear; |
|
33 |
|
|
34 |
/** |
|
35 |
* 实例演示开关 |
|
36 |
*/ |
|
37 |
private boolean demoEnabled; |
|
38 |
|
|
39 |
/** |
|
40 |
* 缓存懒加载 |
|
41 |
*/ |
|
42 |
private boolean cacheLazy; |
|
43 |
|
|
44 |
/** |
|
45 |
* 获取地址开关 |
|
46 |
*/ |
|
47 |
@Getter |
|
48 |
private static boolean addressEnabled; |
|
49 |
|
|
50 |
public void setAddressEnabled(boolean addressEnabled) { |
|
51 |
DLConfig.addressEnabled = addressEnabled; |
|
52 |
} |
|
53 |
|
|
54 |
/** 上传路径 */ |
|
55 |
private static String profile; |
|
56 |
|
|
57 |
|
|
58 |
/** 验证码类型 */ |
|
59 |
private static String captchaType; |
|
60 |
|
|
61 |
public String getName() |
|
62 |
{ |
|
63 |
return name; |
|
64 |
} |
|
65 |
|
|
66 |
public void setName(String name) |
|
67 |
{ |
|
68 |
this.name = name; |
|
69 |
} |
|
70 |
|
|
71 |
public String getVersion() |
|
72 |
{ |
|
73 |
return version; |
|
74 |
} |
|
75 |
|
|
76 |
public void setVersion(String version) |
|
77 |
{ |
|
78 |
this.version = version; |
|
79 |
} |
|
80 |
|
|
81 |
public String getCopyrightYear() |
|
82 |
{ |
|
83 |
return copyrightYear; |
|
84 |
} |
|
85 |
|
|
86 |
public void setCopyrightYear(String copyrightYear) |
|
87 |
{ |
|
88 |
this.copyrightYear = copyrightYear; |
|
89 |
} |
|
90 |
|
|
91 |
public static String getProfile() |
|
92 |
{ |
|
93 |
return profile; |
|
94 |
} |
|
95 |
|
|
96 |
public void setProfile(String profile) |
|
97 |
{ |
|
98 |
DLConfig.profile = profile; |
|
99 |
} |
|
100 |
|
|
101 |
public static boolean isAddressEnabled() |
|
102 |
{ |
|
103 |
return addressEnabled; |
|
104 |
} |
|
105 |
|
|
106 |
|
|
107 |
public static String getCaptchaType() { |
|
108 |
return captchaType; |
|
109 |
} |
|
110 |
|
|
111 |
public void setCaptchaType(String captchaType) { |
|
112 |
DLConfig.captchaType = captchaType; |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* 获取导入上传路径 |
|
117 |
*/ |
|
118 |
public static String getImportPath() |
|
119 |
{ |
|
120 |
return getProfile() + "/import"; |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* 获取头像上传路径 |
|
125 |
*/ |
|
126 |
public static String getAvatarPath() |
|
127 |
{ |
|
128 |
return getProfile() + "/avatar"; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* 获取下载路径 |
|
133 |
*/ |
|
134 |
public static String getDownloadPath() |
|
135 |
{ |
|
136 |
return getProfile() + "/download/"; |
|
137 |
} |
|
138 |
|
|
139 |
/** |
|
140 |
* 获取上传路径 |
|
141 |
*/ |
|
142 |
public static String getUploadPath() |
|
143 |
{ |
|
144 |
return getProfile() + "/upload"; |
|
145 |
} |
|
146 |
|
|
147 |
|
|
148 |
} |