Difference between using bean id and name in Spring configuration file

后端 未结 6 1125
忘了有多久
忘了有多久 2020-12-04 05:24

Is there any difference between using an id attribute and name attribute on a element in a Spring configuration file?

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 06:22

    Both id and name are bean identifiers in Spring IOC container/ApplicationContecxt. The id attribute lets you specify exactly one id but using name attribute you can give alias name to that bean.

    You can check the spring doc here.

提交回复
热议问题