java如何在playFramework中重用控制器类的功能
假设我在控制器类中有两个函数:
public class Application extends Controller {
public static Result method1() {
String results;
//step1
//step2
//step3
...
return ok(results);
}
public static Result method2() {
String results;
//step1
//step2
//step3
//step4
return ok(results);
}
}
在这两种方法中,从1到3的步骤在两个函数中完全相同
在method2()
中是否有使用method1()
的方法,即在method2()
中调用method1()
的方法
注意: 我知道我可以创建一个执行步骤1到步骤3的方法,并在控制器的方法中使用该方法,但我不想这样做,因为它会进一步增加复杂性
共 (0) 个答案