简体   繁体   中英

Why use “value” but not “ref” for property value in spring.net config

Recently when I read the Spring.net's documentation . I found there is one place that is quite confusing to me. In 5.3.2.1.1, the doc said as below:

<object id="theTargetObject" type="...">     . . . </object>

<object id="theClientObject" type="...">   
    <property name="targetName"> 
        <idref object="theTargetObject"/>
    </property>
</object> 

This above object definition snipped is exactly equivalent (at runtime) to the following snippit:

<object id="theTargetObject" type="...">    . . . </object>

<object id="theClientObject" type="...">      
      <property name="targetName" value="theTargetObject"/>
</object>

I think there is a mistake here, in the second code snippet, the attribute "value" should be "ref" as its value refers to the theTargetObject and not a raw string value. Am I right? Thank you for anyone who is verifying that.

我进行了测试,发现在这种情况下使用值不正确,应该为“ ref”或“ idref”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM