Spring Best Practices
Spring tries to create a new Map
/Collection
instance and fill
the new instance by iterating and converting values of the original
Map
/Collection
(IMap
, IQueue
, etc.) to required types when generic
type parameters of the original Map
/Collection
and the target property/attribute do not match.
Since Hazelcast Map
s/Collection
s are designed to hold very large
data which a single machine cannot carry, iterating through whole values can cause out of memory errors.
To avoid this issue, the target property/attribute can be declared as
un-typed Map
/Collection
as shown below.
Or, parameters of injection methods (constructor, setter) can be un-typed as shown below.
See Spring issue-3407 for more information. |