方法context.getBean(名前、ユーザー)のドキュメントは春とランタイム
言う/ファクトリメソッドに 引数
を明示的なコンストラクタの引数を指定することができますが、私が何をしても(すべて試してみて)、最も論理的な設定で、初期化中にBeanがロードされるときにこれを取得します:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'fileValidator' defined in
PortletContext resource
[/WEB-INF/classes/context/customer-form-portlet.xml]: Unsatisfied
dependency expressed through constructor argument with index 0 of type
[com.liferay.portal.model.User]: Ambiguous factory method argument
types - did you specify the correct bean references as factory method
arguments?
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'fileValidator' defined in
PortletContext resource
[/WEB-INF/classes/context/customer-form-portlet.xml]: Unsatisfied
dependency expressed through constructor argument with index 0 of type
[com.liferay.portal.model.User]: Ambiguous factory method argument
types - did you specify the correct bean references as factory method
arguments?
は
<bean id="fileValidator"
class="cz.instance.transl.validation.file.FileValidator"
factory-method="createInstance" />
private FileValidator(User user) {
this.user = user;
}
public static FileValidator createInstance(User user) {
return new FileValidator(user);
}
解説は、あなたがそれを行うことができますが、XMLのそのBeanのdefinitonかないでコンストラクタの引数を指定した場合、それが失敗したと言います。
残念ながら、プロトタイプとしても同じ方法で失敗します。 3.1.0.M2を使う – lisak
@lisak:最初に、ベータ版の使用をやめ、安定版(つまり3.0.x)に固執する – skaffman
これは3.1.0.M2のバグでなければならない。その理由を見つけるために、私はそれを見つけると私は切符を上げようとします。ありがとうございます – lisak