diff --git a/doc/md/deploy.md b/doc/md/deploy.md index 7f27cafe8..3e27bccfb 100644 --- a/doc/md/deploy.md +++ b/doc/md/deploy.md @@ -40,7 +40,7 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: lengleng - url: jdbc:mysql://mysql:3306/pigx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false + url: jdbc:mysql://mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false ``` diff --git a/doc/md/elastic-job-monitor-platform.md b/doc/md/elastic-job-monitor-platform.md index 10fb7a895..cd67e4ca6 100644 --- a/doc/md/elastic-job-monitor-platform.md +++ b/doc/md/elastic-job-monitor-platform.md @@ -49,7 +49,7 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: 123456 - url: jdbc:mysql://mysql:3306/pigx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false + url: jdbc:mysql://mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false elasticjob: # 分布式任务协调依赖zookeeper zookeeper: diff --git a/pigx-auth/pom.xml b/pigx-auth/pom.xml index 84db1e3dd..7cd528010 100644 --- a/pigx-auth/pom.xml +++ b/pigx-auth/pom.xml @@ -50,6 +50,12 @@ pigx-common-security ${pigx.version} + + + com.pig4cloud + pigx-common-cache + ${pigx.version} + org.springframework.cloud diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/PigxTokenEndpoint.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/PigxTokenEndpoint.java index c17aa1690..462ece856 100644 --- a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/PigxTokenEndpoint.java +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/PigxTokenEndpoint.java @@ -26,7 +26,6 @@ import com.pig4cloud.pigx.common.core.constant.SecurityConstants; import com.pig4cloud.pigx.common.core.util.R; import com.pig4cloud.pigx.common.core.util.TenantUtils; import com.pig4cloud.pigx.common.security.service.PigxUser; -import com.pig4cloud.pigx.common.security.util.SecurityUtils; import lombok.AllArgsConstructor; import org.springframework.data.redis.core.ConvertingCursor; import org.springframework.data.redis.core.Cursor; diff --git a/pigx-common/pigx-common-cache/src/main/java/com/pig4cloud/pigx/common/cache/RedisKeySerializer.java b/pigx-common/pigx-common-cache/src/main/java/com/pig4cloud/pigx/common/cache/RedisKeySerializer.java deleted file mode 100644 index ad914e488..000000000 --- a/pigx-common/pigx-common-cache/src/main/java/com/pig4cloud/pigx/common/cache/RedisKeySerializer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.common.cache; -import org.springframework.cache.interceptor.SimpleKey; -import org.springframework.core.convert.ConversionService; -import org.springframework.core.convert.support.DefaultConversionService; -import org.springframework.data.redis.serializer.RedisSerializer; -import org.springframework.lang.Nullable; -import org.springframework.util.Assert; - -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; - -/** - * 将redis key序列化为字符串 - * - *

- * spring cache中的简单基本类型直接使用 StringRedisSerializer 会有问题 - *

- * - * @author L.cm - */ -public class RedisKeySerializer implements RedisSerializer { - private final Charset charset; - private final ConversionService converter; - - public RedisKeySerializer() { - this(StandardCharsets.UTF_8); - } - - public RedisKeySerializer(Charset charset) { - Assert.notNull(charset, "Charset must not be null!"); - this.charset = charset; - this.converter = DefaultConversionService.getSharedInstance(); - } - - @Override - public Object deserialize(byte[] bytes) { - throw new RuntimeException("Used only for serializing key, not for deserialization."); - } - - @Override - @Nullable - public byte[] serialize(@Nullable Object object) { - if (object == null) { - return null; - } - String key; - if (object instanceof SimpleKey) { - key = ""; - } else if (object instanceof String) { - key = (String) object; - } else { - key = converter.convert(object, String.class); - } - return key.getBytes(this.charset); - } - -} diff --git a/pigx-common/pigx-common-cache/src/main/java/com/pig4cloud/pigx/common/cache/RedisTemplateConfig.java b/pigx-common/pigx-common-cache/src/main/java/com/pig4cloud/pigx/common/cache/RedisTemplateConfig.java index 4d62b16fd..554edb082 100644 --- a/pigx-common/pigx-common-cache/src/main/java/com/pig4cloud/pigx/common/cache/RedisTemplateConfig.java +++ b/pigx-common/pigx-common-cache/src/main/java/com/pig4cloud/pigx/common/cache/RedisTemplateConfig.java @@ -19,13 +19,13 @@ package com.pig4cloud.pigx.common.cache; import lombok.AllArgsConstructor; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.*; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; /** * RedisTemplate 配置 @@ -40,15 +40,13 @@ public class RedisTemplateConfig { private final RedisConnectionFactory redisConnectionFactory; @Bean - @ConditionalOnMissingBean(RedisTemplate.class) public RedisTemplate redisTemplate() { RedisTemplate redisTemplate = new RedisTemplate<>(); - redisTemplate.setKeySerializer(new RedisKeySerializer()); - redisTemplate.setHashKeySerializer(new RedisKeySerializer()); + redisTemplate.setKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer()); redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer()); redisTemplate.setConnectionFactory(redisConnectionFactory); return redisTemplate; } - } diff --git a/pigx-config/src/main/resources/config/pigx-auth-dev.yml b/pigx-config/src/main/resources/config/pigx-auth-dev.yml index e4187342e..f132fb05f 100644 --- a/pigx-config/src/main/resources/config/pigx-auth-dev.yml +++ b/pigx-config/src/main/resources/config/pigx-auth-dev.yml @@ -5,4 +5,4 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: 123456 - url: jdbc:mysql://mysql:3306/pigx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false + url: jdbc:mysql://mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false diff --git a/pigx-config/src/main/resources/config/pigx-codegen-dev.yml b/pigx-config/src/main/resources/config/pigx-codegen-dev.yml index 133c73ab7..509fa8afd 100644 --- a/pigx-config/src/main/resources/config/pigx-codegen-dev.yml +++ b/pigx-config/src/main/resources/config/pigx-codegen-dev.yml @@ -13,7 +13,7 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: 123456 - url: jdbc:mysql://mysql:3306/pigx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false + url: jdbc:mysql://mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss diff --git a/pigx-config/src/main/resources/config/pigx-daemon-dev.yml b/pigx-config/src/main/resources/config/pigx-daemon-dev.yml index 5bb30138b..db0e40c61 100644 --- a/pigx-config/src/main/resources/config/pigx-daemon-dev.yml +++ b/pigx-config/src/main/resources/config/pigx-daemon-dev.yml @@ -14,7 +14,7 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: 123456 - url: jdbc:mysql://mysql:3306/pigx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false + url: jdbc:mysql://mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false elasticjob: # 分布式任务协调依赖zookeeper zookeeper: diff --git a/pigx-config/src/main/resources/config/pigx-upms-dev.yml b/pigx-config/src/main/resources/config/pigx-upms-dev.yml index 146ad8087..40cc25626 100644 --- a/pigx-config/src/main/resources/config/pigx-upms-dev.yml +++ b/pigx-config/src/main/resources/config/pigx-upms-dev.yml @@ -13,7 +13,7 @@ spring: driver-class-name: com.mysql.jdbc.Driver username: root password: 123456 - url: jdbc:mysql://mysql:3306/pigx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false + url: jdbc:mysql://mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false # swagger相关配置,覆盖全局配置 swagger: