我想初始化一个具有以下属性的bean:
private Iterable<Map.Entry<String, String>> groupToAuthorityMappings;
在我的 context.xml 中,我希望这样做:
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd"
default-autowire="byName">
<beans:bean id="crowdUserDetailsService"
class="com.atlassian.crowd.integration.springsecurity.user.CrowdUserDetailsServiceImpl">
...
<beans:property name="groupToAuthorityMappings">
<beans:map>
<beans:entry key="Manager" value="ROLE_ADMINISTRATOR,ROLE_USER"/>
</beans:map>
</beans:property>
...
</beans:bean>
</beans:beans>
但我收到以下错误:
java.lang.IllegalStateException: Cannot convert value of type [java.util.LinkedHashMap] to required type [java.lang.Iterable] for property 'groupToAuthorityMappings': no matching editors or conversion strategy found
我无法更改 bean,因为它来自提供的库。有人知道我怎样才能实现我的目标吗?