相关疑难解决方法(0)

Spring并在运行时将参数传递给factory-method

方法context.getBean(name,user)的文档说

允许指定显式构造函数参数/工厂方法参数

但无论我做什么(尝试过一切),在最初的逻辑设置中,当初始化期间加载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 …
Run Code Online (Sandbox Code Playgroud)

java spring factory-method

9
推荐指数
4
解决办法
6万
查看次数

标签 统计

factory-method ×1

java ×1

spring ×1