R
R
Rocket-API
Search…
自定义全局函数
自定义全局函数通过实现接口com.github.alenfive.rocketapi.function.IFunction
1
@Component
2
public class EnvFunction implements IFunction{
3
4
@Autowired
5
private Environment environment;
6
7
@Override
8
public String getVarName() {
9
return "env";
10
}
11
12
public String get(String key){
13
return environment.getProperty(key);
14
}
15
16
public String get(String key,String defaultValue){
17
return environment.getProperty(key,defaultValue);
18
}
19
}
Copied!
函数调用
1
def appName = env.get("spring.application.name")
Copied!
Last modified 1yr ago
Copy link