-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Ricardo Gladwell opened SPR-8714 and commented
We have created a AbstractMap sub-class, SoftExpireHashMap. This has configurable behaviour which is achieved by setting properties. Once the SoftExpireHashMap has been configured, it must have the init() method called on it so that it can start a thread executor which runs in the background periodically pruning expired cached items.
However, using the default converters included with the 3.0.6 version of org.springframework.format.support.FormattingConversionServiceFactoryBean we find that this Map is being shallow copied before being injected into our objects and is, hence, not initialised.
Please see the following test case that replicates this issue:
https://github.com/rgladwell/spring-map-converter-issue
For some reason the MapToMapConverter is copying this Map despite the fact we don't want any conversions carried out on it.
Workaround: We can eliminate this behaviour by calling FormatterRegistry.removeConvertible(Map.class, Map.class) but obviously this is problem if we ever do need Map to Map conversion.
Affects: 3.0.6
Issue Links:
- Collection Binding broken - TypeConverterDelegate does bind Collection Elements to Collection type instead of the collection elements Type [SPR-8674] #13316 Collection Binding broken - TypeConverterDelegate does bind Collection Elements to Collection type instead of the collection elements Type
- SpEL: Unnecessary conversion of Map<?, ?> arguments [SPR-8518] #13163 SpEL: Unnecessary conversion of Map arguments
Referenced from: commits c9607fd, cb5954e
1 votes, 2 watchers