次のプロパティを持つコントローラーがあります。
@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 を使用する必要がありますか?
ご提案いただきありがとうございます。
敬具、
ジム