提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* Copyright 2018-2020 stylefeng & fengshuonan (sn93@qq.com) |
|
3 |
* <p> |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* <p> |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* <p> |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
16 |
package cn.stylefeng.guns.sys.core.properties; |
|
17 |
|
|
18 |
import cn.stylefeng.roses.core.util.ToolUtil; |
|
19 |
import lombok.Data; |
|
20 |
import org.springframework.beans.factory.annotation.Value; |
|
21 |
|
|
22 |
import java.util.Properties; |
|
23 |
|
|
24 |
/** |
|
25 |
* beetl配置(如果需要配置别的配置可参照这个形式自己添加) |
|
26 |
* |
|
27 |
* @author fengshuonan |
|
28 |
* @date 2017-05-24 20:37 |
|
29 |
*/ |
|
30 |
@Data |
|
31 |
public class BeetlProperties { |
|
32 |
|
|
33 |
public static final String BEETLCONF_PREFIX = "beetl"; |
|
34 |
|
|
35 |
private String delimiterStatementStart; |
|
36 |
|
|
37 |
private String delimiterStatementEnd; |
|
38 |
|
|
39 |
private String resourceTagroot; |
|
40 |
|
|
41 |
private String resourceTagsuffix; |
|
42 |
|
|
43 |
private String resourceAutoCheck; |
|
44 |
|
|
45 |
@Value("${spring.mvc.view.prefix}") |
|
46 |
private String prefix; |
|
47 |
|
|
48 |
public Properties getProperties() { |
|
49 |
Properties properties = new Properties(); |
|
50 |
if (ToolUtil.isNotEmpty(delimiterStatementStart)) { |
|
51 |
if (delimiterStatementStart.startsWith("\\")) { |
|
52 |
delimiterStatementStart = delimiterStatementStart.substring(1); |
|
53 |
} |
|
54 |
properties.setProperty("DELIMITER_STATEMENT_START", delimiterStatementStart); |
|
55 |
} |
|
56 |
if (ToolUtil.isNotEmpty(delimiterStatementEnd)) { |
|
57 |
properties.setProperty("DELIMITER_STATEMENT_END", delimiterStatementEnd); |
|
58 |
} else { |
|
59 |
properties.setProperty("DELIMITER_STATEMENT_END", "null"); |
|
60 |
} |
|
61 |
if (ToolUtil.isNotEmpty(resourceTagroot)) { |
|
62 |
properties.setProperty("RESOURCE.tagRoot", resourceTagroot); |
|
63 |
} |
|
64 |
if (ToolUtil.isNotEmpty(resourceTagsuffix)) { |
|
65 |
properties.setProperty("RESOURCE.tagSuffix", resourceTagsuffix); |
|
66 |
} |
|
67 |
if (ToolUtil.isNotEmpty(resourceAutoCheck)) { |
|
68 |
properties.setProperty("RESOURCE.autoCheck", resourceAutoCheck); |
|
69 |
} |
|
70 |
return properties; |
|
71 |
} |
|
72 |
} |