1 class JedisHelper { public static <T, R> T getBySecond(String cacheKey, int seconds, R p, Function<Object, T> function) { return function.apply(p); } public static <T> T getBySecond(String cacheKey, int seconds, Supplier<T> funct…
Redis获取缓存异常:java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to XXX. 出现这种异常,我需要自定义ObjectMapper,设置一些参数,而不是直接使用Jackson2JsonRedisSerializer类中黙认的ObjectMapper,看源代码可以知道,Jackson2JsonRedisSerializer中的ObjectMapper是直接使用new ObjectMapper()创建的…