From a36dbe90221924f3b883ac19778d19b2c3344655 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 9 Feb 2016 14:19:38 +0100 Subject: [PATCH] DATACMNS-815 - Made static type cache non-static in SimpleTypeInformationMapper. We now use a non-static cache for TypeInformation instances in SimpleTypeInformationMapper to make sure Spring Boot's development tools can correctly reload classes. Deprecated the use of the static instance of SimpleTypeInformationMapper in favor instantiating it directly. --- .../springframework/data/convert/DefaultTypeMapper.java | 4 ++-- .../data/convert/SimpleTypeInformationMapper.java | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java b/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java index 9bc99009b..87abbef21 100644 --- a/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java +++ b/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ public class DefaultTypeMapper implements TypeMapper { * @param accessor must not be {@literal null}. */ public DefaultTypeMapper(TypeAliasAccessor accessor) { - this(accessor, Arrays.asList(SimpleTypeInformationMapper.INSTANCE)); + this(accessor, Arrays.asList(new SimpleTypeInformationMapper())); } /** diff --git a/src/main/java/org/springframework/data/convert/SimpleTypeInformationMapper.java b/src/main/java/org/springframework/data/convert/SimpleTypeInformationMapper.java index 9fe19ba6d..04f5c626a 100644 --- a/src/main/java/org/springframework/data/convert/SimpleTypeInformationMapper.java +++ b/src/main/java/org/springframework/data/convert/SimpleTypeInformationMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2014 the original author or authors. + * Copyright 2011-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,13 @@ import org.springframework.util.StringUtils; */ public class SimpleTypeInformationMapper implements TypeInformationMapper { + /** + * @deprecated prefer to instantiate directly. + */ + @Deprecated // public static final SimpleTypeInformationMapper INSTANCE = new SimpleTypeInformationMapper(); - private static final Map> CACHE = new ConcurrentHashMap>(); + + private final Map> CACHE = new ConcurrentHashMap>(); /** * Returns the {@link TypeInformation} that shall be used when the given {@link String} value is found as type hint.