环境:
野蝇 9.0.1
JSF:jsf-impl-2.2.11-jbossorg-1
焊接:wildfly-weld-9.0.1
我有这种情况:
客户控制器.java
public abstract class CustomerController {
public String registerCustomer(){
//Do something and return success page
return SUCCESS_PAGE;
}
}
Type1CustomerController.java
@Named
@ViewScoped
public class Type1CustomerController extends CustomerController{
public String registerCustomer(){
super.registerCustomer();
//Special case, just go back to login and allow login
return SUCCESS_LOGIN_PAGE;
}
}
Type2CustomerController.java
@Named
@ViewScoped
public class Type2CustomerController extends CustomerController {
//Does not override the registerCustomer method, but adds some functionlities based on some abstract definitions on the superclass and simply shows success_page
}
客户选择控制器.java
@ApplicationScoped
public class CustomerSelectionController {
@Inject
private Instance<Type2CustomerController> type2CustomerController;
@Inject
private Instance<Type1CustomerController> type1CustomerController;
@Produces
@ViewScoped
@Named("customerController")
public CustomerController customerController() {
if(someConditionsAreMet())
return type1CustomerController.get();
//Otherwise return type2 customer controller
return type2CustomerController.get();
}
}
Now when the Type2CustomerController
is selected, everything works fine. 当Type1CustomerController
, 灾难来袭时:
Method not found: class com.mycompany.view.internal.controller.customer.Type1CustomerController$Proxy$_$$_WeldClientProxy.registerCustomer()
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:109)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
EL 找不到在 Type1Controller 中覆盖的超类方法可能是什么问题?