Spring autowiring setter/constructor PROs and CONs

前端 未结 4 947
别跟我提以往
别跟我提以往 2021-02-05 15:15

When using @Autowired (not xml configuration), could someone compare the set/constructor binding advantages and disadvantages?

See the following examples:



        
4条回答
  •  故里飘歌
    2021-02-05 15:54

    A specific reason for annotating setters: The setters can then save bean references to static variables.

提交回复
热议问题