【发布时间】:2014-03-17 15:53:17
【问题描述】:
我有一个具有以下属性的控制器:
@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 做到这一点(也许使用 ValueExpression 中指定的 ManagedProperty documentation)?或者我必须使用 CDI 吗?
非常感谢您的建议!
亲切的问候,
Zim
【问题讨论】:
标签: jsf cdi managed-property