mirror of
https://gitee.com/dromara/sa-token.git
synced 2024-12-02 11:57:40 +08:00
!73 处理session持久化到redis时,LocalDateTime等java8的新时间类序列化失败的问题
Merge pull request !73 from 阿超/dev
This commit is contained in:
commit
73d4fe5071
@ -35,6 +35,12 @@
|
||||
<version>2.11.2</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.11.2</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@ -60,6 +61,7 @@ public class SaTokenDaoRedisJackson implements SaTokenDao {
|
||||
field.setAccessible(true);
|
||||
ObjectMapper objectMapper = (ObjectMapper) field.get(valueSerializer);
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
objectMapper.registerModule(new JavaTimeModule());
|
||||
this.objectMapper = objectMapper;
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user