0
https://www.tutorialspoint.com/spring/constructor_based_dependency_injection.htm值與參考之間的彈簧差值
我的問題在本教程的最後一句中。
A final note, in case you are passing a reference to an object,
you need to use ref attribute of <constructor-arg> tag and
if you are passing a value directly then you should use value
attribute as shown above.
我對什麼是對象的引用和什麼是值有點困惑。
我可以說所有的主類型都是值,所有的java類和bean都是引用嗎?
這裏還有什麼可以用作參考?
非常感謝你
明白了,謝謝。那麼Java類呢? –
將使用bean實例化一個java類。所以需要給這個bean一個id然後引用它使用「ref」字段 – user3206236
我看,謝謝 –