环境:
Wildfly 9.0.1
JSF:jsf-impl-2.2.11-jbossorg-1
WELD:wildfly-weld-9.0.1
我有这种情况:
CustomerController.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
}
CustomerSelectionController.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();
}
}
现在选择Type2CustomerController
时,一切正常。
当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中的超类方法覆盖?