Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Spring and the fly likes Spring Bean Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Bean Collection" Watch "Spring Bean Collection" New topic

Spring Bean Collection

Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426

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.

Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
I agree. Here's the link:
subject: Spring Bean Collection
It's not a secret anymore!