• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Spring Bean Collection

 
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

reply
    Bookmark Topic Watch Topic
  • New Topic