在 Spring Bean 上下文中声明对象数组
我正在尝试在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>
我无法在有关如何执行此操作的文档中找到示例或内容。另外,您对实现我正在尝试的更好方法有任何建议,请:)告诉我。