我试图在Spring上下文文件中创建一个对象数组,这样我就可以将其注入到如下声明的构造函数中:
public RandomGeocodingService(GeocodingService... services) { }
我正在尝试使用<array>
标记:
<bean id="googleGeocodingService" class="geocoding.GoogleGeocodingService">
<constructor-arg ref="proxy" />
<constructor-arg value="" />
</bean>
<bean id="geocodingService" class="geocoding.RandomGeocodingService">
<constructor-arg>
<array value-type="geocoding.GeocodingService">
<!-- How do I reference the google geocoding service here? -->
</array>
</constructor-arg>
</bean>
我在文档中找不到关于如何做到这一点的示例或其他东西。另外,你有任何建议可以更好地实现我正在尝试做的事情,请让我知道:)。
https://stackoverflow.com/questions/3610804
复制相似问题