我有一个具有以下属性的控制器:
@ManagedProperty(value="#{remoteApplication}")
private transient ProcessService applicationService;
@ManagedProperty(value="#{remoteSystem}")
private transient SystemService systemService;
@ManagedProperty(value="#{remoteFileSystem}")
private transient FileSystemService fileSystemService;
我想根据属性文件有条件地注入bean,该文件告诉服务是本地的还是远程的。
上面提供的示例适用于远程,对于本地,将是:
@ManagedProperty(value="#{localApplication}")
private transient ProcessService applicationService;
@ManagedProperty(value="#{localSystem}")
private transient SystemService systemService;
@ManagedProperty(value="#{localFileSystem}")
private transient FileSystemService fileSystemService;
有没有办法用 JSF 做到这一点(可能使用ManagedProperty 文档ValueExpression
中指定的方法)?或者我必须使用 CDI 吗?
非常感谢您的建议!
亲切的问候,
津