开发者

spring collection implementation of injection

开发者 https://www.devze.com 2022-12-07 21:07 出处:网络
I am kinda new to Spring. My Springframework version is 5.3.9. What specific implementation does Spring choose to be injected?

I am kinda new to Spring.

My Springframework version is 5.3.9.

What specific implementation does Spring choose to be injected?

for example I have

// bean class

private Map<String,String> myMap;

public void setMyMap(Map<String, String> my开发者_开发知识库Map) {
    this.myMap = myMap;
}
<!-- bean def xml -->
<bean id="student" class="com.my.bean.Student">
    <property name="myMap">
        <map>
            <entry key="name" value="someName"/>
            <entry key="school" value="someSchool"/>
        </map>
    </property>
</bean>

Questions:

  • Does Spring choose HashMap as implementation to be injected? Or Other implementation?
  • Does Spring allow choose of implementation class
  • Suppose the default implementation class will change with versions where could I find docs about this.

Many Thanks

My Efforts:

  • I read the spring-framewwork5.x doc and searched for collection implementation class but failed to find it.

  • I also try to read the spring-framework5.x sourcecode org.springframework.beans.factory.supportDefaultListableBeanFactory#resolveMultipleBeans But still fail to find the implementation class.

  • My Java is not excellent

  • Googled about it but didn't find

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号