提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng) |
|
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.beetl; |
|
17 |
|
|
18 |
import cn.stylefeng.guns.base.auth.context.LoginContext; |
|
19 |
import cn.stylefeng.guns.base.consts.ConstantsContext; |
|
20 |
import cn.stylefeng.guns.base.i18n.context.UserTranslationContext; |
|
21 |
import cn.stylefeng.roses.core.util.ToolUtil; |
|
22 |
import org.beetl.ext.spring.BeetlGroupUtilConfiguration; |
|
23 |
|
|
24 |
/** |
|
25 |
* beetl拓展配置,绑定一些工具类,方便在模板中直接调用 |
|
26 |
* |
|
27 |
* @author stylefeng |
|
28 |
* @Date 2018/2/22 21:03 |
|
29 |
*/ |
|
30 |
public class BeetlConfiguration extends BeetlGroupUtilConfiguration { |
|
31 |
|
|
32 |
private LoginContext loginContext; |
|
33 |
|
|
34 |
public BeetlConfiguration(LoginContext loginContext) { |
|
35 |
this.loginContext = loginContext; |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public void initOther() { |
|
40 |
groupTemplate.registerFunctionPackage("shiro", loginContext); |
|
41 |
groupTemplate.registerFunctionPackage("tool", new ToolUtil()); |
|
42 |
groupTemplate.registerFunctionPackage("constants", new ConstantsContext()); |
|
43 |
groupTemplate.registerFunctionPackage("lang", new UserTranslationContext()); |
|
44 |
} |
|
45 |
} |