| Author |
How to inject TreeMap?
|
Kamil Kuchta
Greenhorn
Joined: Mar 09, 2009
Posts: 17
|
|
How to inject TreeMap?
This map is fulfill in the application.
My beans
And setter in class House
Exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'house' defined in file [snowWhiteBeans.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dwarfs' of bean class [pl.edu.agh.snowwhite.logic.House]: Bean property 'dwarfs' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
And what with generic data information Map<String, Dwarf>? Should bean contain this generic information?
|
 |
Vivek K Singh
Ranch Hand
Joined: Dec 22, 2009
Posts: 85
|
|
It should work, Try this:
And write the context as.
|
SCJP 6
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
Is your setter method in the correct House class ? (pl.edu.agh.snowwhite.logic.House.java)
|
[My Blog]
All roads lead to JavaRanch
|
 |
Kamil Kuchta
Greenhorn
Joined: Mar 09, 2009
Posts: 17
|
|
|
It turns out that I already had a getter getDwarfs() which returns a length of collection. When I changed bean name from dwarfs to dwarfsMap (and setter name setDwarfsMap) it started work. I think that that getter was a reason of my problems
|
 |
 |
|
|
subject: How to inject TreeMap?
|
|
|