This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring Bean Collection  RSS feed

 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am currently reading the book spring recipes but I just encounter some problem which I cannot understand thoroughly.

It has a Java class that has List Collection as its instance variable.



Now in the book, it says that to supply values in the bean definition xml, we should make use of the <list> tag and so it is working.

But I tried to experiment a little and change the implementation to a <set> tag instead of a list. My expectation is that it will cause
some sort of classcastexception but it works fine and no error happens.



Because as I know both Set and List Interface inherits from the Collection Interface but I cant cast them to one another.

I am not sure if I miss something Spring basic or Java Basic.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!