用于所有数据源连接的连接池类。它有一个静态枚举来指示连接类型。
class ConnectionPool {
public static enum Type {
t1,
t2,
t3;
}
…
}
另一个类没有默认承包商,构造函数将 Type 作为承包商参数
class Update {
public Update(Type type) {
this.type = type;
}
...
}
在applicationContext.xml中,定义了一个bean
<bean id="update" class="package.Update">
<contructor-arg type="package.ConnectionPool.Type">
<value>Type.t1</value>
</contructor-arg>
</bean>
但我得到了
Error creating bean with name 'update' defined in class path resource [applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [package.ConnectionPools$PoolType]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?