非常君

Results 1 comments of 非常君

> ### 问题描述 > 我在springboot项目中,想通过fastjson2序列化redis的ValueSerializer和HashValueSerializer以下为序列化和反序列化代码 ![image](https://user-images.githubusercontent.com/62325709/184270396-9ecc2bd7-2149-48af-8595-3b4043c2e1c3.png) > > 我序列化到redis的时候是正常的, 使用JSON.toJSONBytes(T) 值如下 {"attributes":{"java.security.Principal":{"authenticated":true,"authorities":[{"authority":"ROLE_admin"},{"authority":"ROLE_user"}],"details":{"remoteAddress":"127.0.0.1","sessionId":"A945B195F014D0BA4C8F0FA42D228153"},"name":"leon","principal":{"accountNonExpired":true,"accountNonLocked":true,"attributes":{},"authorities":[{"authority":"ROLE_admin"},{"authority":"ROLE_user"}],"credentialsNonExpired":true,"email":"[[email protected]](mailto:[email protected])","enabled":true,"name":"leon","nickname":"leon","phone":"18137772224","userId":1,"username":"leon"}},"org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest":{"additionalParameters":{},"attributes":{},"authorizationRequestUri":"[http://127.0.0.1:9000/whale/oauth2/authorize?response_type=code&client_id=web&scope=all&redirect_uri=https://www.baidu.com","authorizationUri":"http://127.0.0.1:9000/whale/oauth2/authorize","clientId":"web","grantType":{"value":"authorization_code"},"redirectUri":"https://www.baidu.com","responseType":{"value":"code"},"scopes":["all"]},"state":"-q2sa200GhpO36UKcZ4BXgx9gxAqudwKg4i4tTYjMLo="},"authorizationGrantType":{"value":"authorization_code"},"id":"10ce34de-b5e3-4e2c-a3ab-73fa0a7bb46d","principalName":"leon","registeredClientId":"web"}](http://127.0.0.1:9000/whale/oauth2/authorize?response_type=code&client_id=web&scope=all&redirect_uri=https://www.baidu.com%22,%22authorizationUri%22:%22http://127.0.0.1:9000/whale/oauth2/authorize%22,%22clientId%22:%22web%22,%22grantType%22:%7B%22value%22:%22authorization_code%22%7D,%22redirectUri%22:%22https://www.baidu.com%22,%22responseType%22:%7B%22value%22:%22code%22%7D,%22scopes%22:%5B%22all%22%5D%7D,%22state%22:%22-q2sa200GhpO36UKcZ4BXgx9gxAqudwKg4i4tTYjMLo=%22%7D,%22authorizationGrantType%22:%7B%22value%22:%22authorization_code%22%7D,%22id%22:%2210ce34de-b5e3-4e2c-a3ab-73fa0a7bb46d%22,%22principalName%22:%22leon%22,%22registeredClientId%22:%22web%22%7D) > > 但是我当反序列化的时候就会提示不可以转换 异常信息 java.lang.ClassCastException: com.alibaba.fastjson2.JSONObject cannot be cast to org.springframework.security.oauth2.server.authorization.OAuth2Authorization > > 目标转换的类 ![image](https://user-images.githubusercontent.com/62325709/184271894-2215e509-1e2e-4b44-a70d-8a85c01eaba1.png) > > ###...