• 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

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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!