我正在尝试在Spring上下文文件中创建一个对象数组,因此我可以将它注入一个声明如下的构造函数:
public RandomGeocodingService(GeocodingService... services) { }
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用<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>
Run Code Online (Sandbox Code Playgroud)
我无法在文档中找到有关如何执行此操作的示例或内容.此外,你有任何建议,以更好的方式来实现我正在尝试做的事情,请让我知道:).