Reputation: 3
I am not familiar with Java or Spring. I have a bean injected which is a Map. I want to inject another bean which will be Set of all the keys in Map.
`
<util:map id="servers">
<entry key="www.google.com" value="google" />
<entry key="www.amazon.com" value="amazon" />
<entry key="www.apple.com" value="apple" />
</util:map>
`
I want use this bean to create a Set by calling Map.keySet() method. `
<bean id="serverHosts" >
<value></value>
</bean>
` How to I initialize this bean?
Upvotes: 0
Views: 1037
Reputation: 10709
Try with
<bean id="serverHosts" factory-method="keySet" factory-bean="servers" />
Upvotes: 2