[ 
https://issues.apache.org/jira/browse/SCB-2422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

liubao updated SCB-2422:
------------------------
    Summary: change bean injection to constructor injection  (was: 
bean注入代码修改为constructor injection)

> change bean injection to constructor injection
> ----------------------------------------------
>
>                 Key: SCB-2422
>                 URL: https://issues.apache.org/jira/browse/SCB-2422
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: liubao
>            Priority: Major
>             Fix For: java-chassis-2.7.0
>
>
> 尽量避免使用field injection,对于必须依赖,使用 constructor-based injection,对于可选依赖,使用 
> setter-based injection。这里对直接的好处是
> a. 避免循环依赖(强制校验,不要依赖spring三级缓存),我记得之前cse是出现过重构发现大量循环依赖的问题的
> b. 避免依赖为null的场景
> ref: [https://blog.marcnuri.com/field-injection-is-not-recommended]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to