优化redis序列化代码

This commit is contained in:
zlt2000
2020-05-04 21:14:39 +08:00
parent 9d7b52127f
commit 540c46e90e
3 changed files with 53 additions and 165 deletions
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.security.oauth2.provider.token.TokenStore;
/**
@@ -13,17 +14,14 @@ import org.springframework.security.oauth2.provider.token.TokenStore;
*
* @author zlt
* @date 2018/7/25 9:36
* <p>
* Blog: https://zlt2000.gitee.io
* Github: https://github.com/zlt2000
*/
@ConditionalOnProperty(prefix = "zlt.oauth2.token.store", name = "type", havingValue = "redis", matchIfMissing = true)
public class AuthRedisTokenStore {
@Autowired
private RedisConnectionFactory connectionFactory;
@Autowired
private SecurityProperties securityProperties;
@Bean
public TokenStore tokenStore() {
public TokenStore tokenStore(RedisConnectionFactory connectionFactory, SecurityProperties securityProperties) {
return new CustomRedisTokenStore(connectionFactory, securityProperties);
}
}