修复后台问题
parent
895b58c337
commit
936ac913c5
|
|
@ -3,7 +3,8 @@ package com.yanzhu.framework.tenant.config;
|
|||
import com.yanzhu.framework.common.biz.system.tenant.TenantCommonApi;
|
||||
import com.yanzhu.framework.common.enums.WebFilterOrderEnum;
|
||||
import com.yanzhu.framework.mybatis.core.util.MyBatisUtils;
|
||||
import com.yanzhu.framework.redis.config.YudaoCacheProperties;
|
||||
import com.yanzhu.framework.redis.config.YanzhuCacheProperties;
|
||||
import com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.security.core.service.SecurityFrameworkService;
|
||||
import com.yanzhu.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.yanzhu.framework.tenant.core.aop.TenantIgnoreAspect;
|
||||
|
|
@ -54,7 +55,7 @@ import static com.yanzhu.framework.common.util.collection.CollectionUtils.conver
|
|||
@AutoConfiguration
|
||||
@ConditionalOnProperty(prefix = "yanzhu.tenant", value = "enable", matchIfMissing = true) // 允许使用 yanzhu.tenant.enable=false 禁用多租户
|
||||
@EnableConfigurationProperties(TenantProperties.class)
|
||||
public class YudaoTenantAutoConfiguration {
|
||||
public class YanzhuTenantAutoConfiguration {
|
||||
|
||||
@Resource
|
||||
private ApplicationContext applicationContext;
|
||||
|
|
@ -188,7 +189,7 @@ public class YudaoTenantAutoConfiguration {
|
|||
@Primary // 引入租户时,tenantRedisCacheManager 为主 Bean
|
||||
public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate,
|
||||
RedisCacheConfiguration redisCacheConfiguration,
|
||||
YudaoCacheProperties yanzhuCacheProperties,
|
||||
YanzhuCacheProperties yanzhuCacheProperties,
|
||||
TenantProperties tenantProperties) {
|
||||
// 创建 RedisCacheWriter 对象
|
||||
RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory());
|
||||
|
|
@ -8,10 +8,10 @@
|
|||
* 6. MQ:在 Producer 发送消息时,Header 带上 tenant-id 租户编号;在 Consumer 消费消息时,将 Header 的 tenant-id 租户编号,添加到租户上下文。
|
||||
* 7. Async:异步需要保证 ThreadLocal 的传递性,通过使用阿里开源的 TransmittableThreadLocal 实现。相关的改造点,可见:
|
||||
* 1)Spring Async:
|
||||
* {@link com.yanzhu.framework.quartz.config.YudaoAsyncAutoConfiguration#threadPoolTaskExecutorBeanPostProcessor()}
|
||||
* {@link com.yanzhu.framework.quartz.config.Yanzhu#threadPoolTaskExecutorBeanPostProcessor()}
|
||||
* 2)Spring Security:
|
||||
* TransmittableThreadLocalSecurityContextHolderStrategy
|
||||
* 和 YudaoSecurityAutoConfiguration#securityContextHolderMethodInvokingFactoryBean() 方法
|
||||
* 和 Yanzhu#securityContextHolderMethodInvokingFactoryBean() 方法
|
||||
*
|
||||
*/
|
||||
package com.yanzhu.framework.tenant;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
cn.iocoder.yudao.framework.tenant.config.YudaoTenantAutoConfiguration
|
||||
com.yanzhu.framework.tenant.config.YanzhuTenantAutoConfiguration
|
||||
|
|
@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@AutoConfiguration
|
||||
public class YudaoDictAutoConfiguration {
|
||||
public class YanzhuDictAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("InstantiationOfUtilityClass")
|
||||
|
|
@ -1 +1 @@
|
|||
cn.iocoder.yudao.framework.dict.config.YudaoDictAutoConfiguration
|
||||
com.yanzhu.framework.dict.config.YanzhuDictAutoConfiguration
|
||||
|
|
@ -14,7 +14,7 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
|||
*/
|
||||
@AutoConfiguration
|
||||
@EnableAsync
|
||||
public class YudaoAsyncAutoConfiguration {
|
||||
public class YanzhuAsyncAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public BeanPostProcessor threadPoolTaskExecutorBeanPostProcessor() {
|
||||
|
|
@ -15,7 +15,7 @@ import java.util.Optional;
|
|||
@AutoConfiguration
|
||||
@EnableScheduling // 开启 Spring 自带的定时任务
|
||||
@Slf4j
|
||||
public class YudaoQuartzAutoConfiguration {
|
||||
public class YanzhuQuartzAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public SchedulerManager schedulerManager(Optional<Scheduler> scheduler) {
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
cn.iocoder.yudao.framework.quartz.config.YudaoQuartzAutoConfiguration
|
||||
cn.iocoder.yudao.framework.quartz.config.YudaoAsyncAutoConfiguration
|
||||
com.yanzhu.framework.quartz.config.YanzhuQuartzAutoConfiguration
|
||||
com.yanzhu.framework.quartz.config.YanzhuAsyncAutoConfiguration
|
||||
|
|
@ -16,7 +16,7 @@ import org.springframework.context.annotation.Bean;
|
|||
@AutoConfiguration
|
||||
@ConditionalOnClass({MeterRegistryCustomizer.class})
|
||||
@ConditionalOnProperty(prefix = "yanzhu.metrics", value = "enable", matchIfMissing = true) // 允许使用 yanzhu.metrics.enable=false 禁用 Metrics
|
||||
public class YudaoMetricsAutoConfiguration {
|
||||
public class YanzhuMetricsAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags(
|
||||
|
|
@ -22,7 +22,7 @@ import org.springframework.context.annotation.Bean;
|
|||
})
|
||||
@EnableConfigurationProperties(TracerProperties.class)
|
||||
@ConditionalOnProperty(prefix = "yanzhu.tracer", value = "enable", matchIfMissing = true)
|
||||
public class YudaoTracerAutoConfiguration {
|
||||
public class YanzhuTracerAutoConfiguration {
|
||||
|
||||
// TODO @芋艿:skywalking 不兼容最新的 opentracing 版本。同时,opentracing 也停止了维护,尬住了!后续换 opentelemetry 即可!
|
||||
// @Bean
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
cn.iocoder.yudao.framework.tracer.config.YudaoTracerAutoConfiguration
|
||||
cn.iocoder.yudao.framework.tracer.config.YudaoMetricsAutoConfiguration
|
||||
com.yanzhu.framework.tracer.config.YanzhuTracerAutoConfiguration
|
||||
com.yanzhu.framework.tracer.config.YanzhuMetricsAutoConfiguration
|
||||
|
|
@ -15,7 +15,7 @@ import org.springframework.context.annotation.Bean;
|
|||
@AutoConfiguration
|
||||
@Slf4j
|
||||
@ConditionalOnClass(name = "org.springframework.amqp.rabbit.core.RabbitTemplate")
|
||||
public class YudaoRabbitMQAutoConfiguration {
|
||||
public class YanzhuRabbitMQAutoConfiguration {
|
||||
|
||||
/**
|
||||
* Jackson2JsonMessageConverter Bean:使用 jackson 序列化消息
|
||||
|
|
@ -9,7 +9,7 @@ import com.yanzhu.framework.mq.redis.core.job.RedisPendingMessageResendJob;
|
|||
import com.yanzhu.framework.mq.redis.core.job.RedisStreamMessageCleanupJob;
|
||||
import com.yanzhu.framework.mq.redis.core.pubsub.AbstractRedisChannelMessageListener;
|
||||
import com.yanzhu.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener;
|
||||
import com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -38,8 +38,8 @@ import java.util.Properties;
|
|||
*/
|
||||
@Slf4j
|
||||
@EnableScheduling // 启用定时任务,用于 RedisPendingMessageResendJob 重发消息
|
||||
@AutoConfiguration(after = YudaoRedisAutoConfiguration.class)
|
||||
public class YudaoRedisMQConsumerAutoConfiguration {
|
||||
@AutoConfiguration(after = YanzhuRedisAutoConfiguration.class)
|
||||
public class YanzhuRedisMQConsumerAutoConfiguration {
|
||||
|
||||
/**
|
||||
* 创建 Redis Pub/Sub 广播消费的容器
|
||||
|
|
@ -2,7 +2,7 @@ package com.yanzhu.framework.mq.redis.config;
|
|||
|
||||
import com.yanzhu.framework.mq.redis.core.RedisMQTemplate;
|
||||
import com.yanzhu.framework.mq.redis.core.interceptor.RedisMessageInterceptor;
|
||||
import com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
@ -16,8 +16,8 @@ import java.util.List;
|
|||
* @author 研筑科技
|
||||
*/
|
||||
@Slf4j
|
||||
@AutoConfiguration(after = YudaoRedisAutoConfiguration.class)
|
||||
public class YudaoRedisMQProducerAutoConfiguration {
|
||||
@AutoConfiguration(after = YanzhuRedisAutoConfiguration.class)
|
||||
public class YanzhuRedisMQProducerAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public RedisMQTemplate redisMQTemplate(StringRedisTemplate redisTemplate,
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
cn.iocoder.yudao.framework.mq.redis.config.YudaoRedisMQProducerAutoConfiguration
|
||||
cn.iocoder.yudao.framework.mq.redis.config.YudaoRedisMQConsumerAutoConfiguration
|
||||
cn.iocoder.yudao.framework.mq.rabbitmq.config.YudaoRabbitMQAutoConfiguration
|
||||
com.yanzhu.framework.mq.redis.config.YanzhuRedisMQProducerAutoConfiguration
|
||||
com.yanzhu.framework.mq.redis.config.YanzhuRedisMQConsumerAutoConfiguration
|
||||
com.yanzhu.framework.mq.rabbitmq.config.YanzhuRabbitMQAutoConfiguration
|
||||
|
|
@ -7,14 +7,14 @@ import com.yanzhu.framework.idempotent.core.keyresolver.IdempotentKeyResolver;
|
|||
import com.yanzhu.framework.idempotent.core.keyresolver.impl.UserIdempotentKeyResolver;
|
||||
import com.yanzhu.framework.idempotent.core.redis.IdempotentRedisDAO;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AutoConfiguration(after = YudaoRedisAutoConfiguration.class)
|
||||
public class YudaoIdempotentConfiguration {
|
||||
@AutoConfiguration(after = YanzhuRedisAutoConfiguration.class)
|
||||
public class YanzhuIdempotentConfiguration {
|
||||
|
||||
@Bean
|
||||
public IdempotentAspect idempotentAspect(List<IdempotentKeyResolver> keyResolvers, IdempotentRedisDAO idempotentRedisDAO) {
|
||||
|
|
@ -8,7 +8,7 @@ import org.springframework.context.annotation.Bean;
|
|||
|
||||
@AutoConfiguration(before = LockAutoConfiguration.class)
|
||||
@ConditionalOnClass(name = "com.baomidou.lock.annotation.Lock4j")
|
||||
public class YudaoLock4jConfiguration {
|
||||
public class YanzhuLock4jConfiguration {
|
||||
|
||||
@Bean
|
||||
public DefaultLockFailureStrategy lockFailureStrategy() {
|
||||
|
|
@ -2,31 +2,28 @@ package com.yanzhu.framework.ratelimiter.config;
|
|||
|
||||
import com.yanzhu.framework.ratelimiter.core.aop.RateLimiterAspect;
|
||||
import com.yanzhu.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver;
|
||||
import com.yanzhu.framework.ratelimiter.core.keyresolver.impl.*;
|
||||
import com.yanzhu.framework.ratelimiter.core.keyresolver.impl.ClientIpRateLimiterKeyResolver;
|
||||
import com.yanzhu.framework.ratelimiter.core.keyresolver.impl.DefaultRateLimiterKeyResolver;
|
||||
import com.yanzhu.framework.ratelimiter.core.keyresolver.impl.ExpressionRateLimiterKeyResolver;
|
||||
import com.yanzhu.framework.ratelimiter.core.keyresolver.impl.ServerNodeRateLimiterKeyResolver;
|
||||
import com.yanzhu.framework.ratelimiter.core.keyresolver.impl.UserRateLimiterKeyResolver;
|
||||
import com.yanzhu.framework.ratelimiter.core.redis.RateLimiterRedisDAO;
|
||||
import com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AutoConfiguration(after = YudaoRedisAutoConfiguration.class)
|
||||
public class YudaoRateLimiterConfiguration {
|
||||
@AutoConfiguration
|
||||
public class YanzhuRateLimiterConfiguration {
|
||||
|
||||
@Bean
|
||||
public RateLimiterAspect rateLimiterAspect(List<RateLimiterKeyResolver> keyResolvers, RateLimiterRedisDAO rateLimiterRedisDAO) {
|
||||
return new RateLimiterAspect(keyResolvers, rateLimiterRedisDAO);
|
||||
@ConditionalOnBean(RedissonClient.class)
|
||||
public RateLimiterAspect rateLimiterAspect(List<RateLimiterKeyResolver> keyResolvers, RedissonClient redissonClient) {
|
||||
return new RateLimiterAspect(keyResolvers, new RateLimiterRedisDAO(redissonClient));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
|
||||
public RateLimiterRedisDAO rateLimiterRedisDAO(RedissonClient redissonClient) {
|
||||
return new RateLimiterRedisDAO(redissonClient);
|
||||
}
|
||||
|
||||
// ========== 各种 RateLimiterRedisDAO Bean ==========
|
||||
|
||||
@Bean
|
||||
public DefaultRateLimiterKeyResolver defaultRateLimiterKeyResolver() {
|
||||
return new DefaultRateLimiterKeyResolver();
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.yanzhu.framework.signature.config;
|
||||
|
||||
import com.yanzhu.framework.signature.core.aop.ApiSignatureAspect;
|
||||
import com.yanzhu.framework.signature.core.redis.ApiSignatureRedisDAO;
|
||||
import com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
@AutoConfiguration(after = YanzhuRedisAutoConfiguration.class)
|
||||
public class YanzhuApiSignatureAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(StringRedisTemplate.class)
|
||||
public ApiSignatureAspect apiSignatureAspect(ApiSignatureRedisDAO signatureRedisDAO) {
|
||||
return new ApiSignatureAspect(signatureRedisDAO);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(StringRedisTemplate.class)
|
||||
public ApiSignatureRedisDAO apiSignatureRedisDAO(StringRedisTemplate stringRedisTemplate) {
|
||||
return new ApiSignatureRedisDAO(stringRedisTemplate);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package com.yanzhu.framework.signature.config;
|
||||
|
||||
import com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.signature.core.aop.ApiSignatureAspect;
|
||||
import com.yanzhu.framework.signature.core.redis.ApiSignatureRedisDAO;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
/**
|
||||
* HTTP API 签名的自动配置类
|
||||
*
|
||||
* @author Zhougang
|
||||
*/
|
||||
@AutoConfiguration(after = YudaoRedisAutoConfiguration.class)
|
||||
public class YudaoApiSignatureAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public ApiSignatureAspect signatureAspect(ApiSignatureRedisDAO signatureRedisDAO) {
|
||||
return new ApiSignatureAspect(signatureRedisDAO);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ApiSignatureRedisDAO signatureRedisDAO(StringRedisTemplate stringRedisTemplate) {
|
||||
return new ApiSignatureRedisDAO(stringRedisTemplate);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
cn.iocoder.yudao.framework.idempotent.config.YudaoIdempotentConfiguration
|
||||
cn.iocoder.yudao.framework.lock4j.config.YudaoLock4jConfiguration
|
||||
cn.iocoder.yudao.framework.ratelimiter.config.YudaoRateLimiterConfiguration
|
||||
cn.iocoder.yudao.framework.signature.config.YudaoApiSignatureAutoConfiguration
|
||||
com.yanzhu.framework.idempotent.config.YanzhuIdempotentConfiguration
|
||||
com.yanzhu.framework.lock4j.config.YanzhuLock4jConfiguration
|
||||
com.yanzhu.framework.ratelimiter.config.YanzhuRateLimiterConfiguration
|
||||
com.yanzhu.framework.signature.config.YanzhuApiSignatureAutoConfiguration
|
||||
|
|
@ -19,15 +19,15 @@ import org.springframework.util.StringUtils;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration.buildRedisSerializer;
|
||||
import static com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration.buildRedisSerializer;
|
||||
|
||||
/**
|
||||
* Cache 配置类,基于 Redis 实现
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties({CacheProperties.class, YudaoCacheProperties.class})
|
||||
@EnableConfigurationProperties({CacheProperties.class, YanzhuCacheProperties.class})
|
||||
@EnableCaching
|
||||
public class YudaoCacheAutoConfiguration {
|
||||
public class YanzhuCacheAutoConfiguration {
|
||||
|
||||
/**
|
||||
* RedisCacheConfiguration Bean
|
||||
|
|
@ -70,7 +70,7 @@ public class YudaoCacheAutoConfiguration {
|
|||
@Bean
|
||||
public RedisCacheManager redisCacheManager(RedisTemplate<String, Object> redisTemplate,
|
||||
RedisCacheConfiguration redisCacheConfiguration,
|
||||
YudaoCacheProperties yanzhuCacheProperties) {
|
||||
YanzhuCacheProperties yanzhuCacheProperties) {
|
||||
// 创建 RedisCacheWriter 对象
|
||||
RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory());
|
||||
RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory,
|
||||
|
|
@ -12,7 +12,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
@ConfigurationProperties("yanzhu.cache")
|
||||
@Data
|
||||
@Validated
|
||||
public class YudaoCacheProperties {
|
||||
public class YanzhuCacheProperties {
|
||||
|
||||
/**
|
||||
* {@link #redisScanBatchSize} 默认值
|
||||
|
|
@ -14,7 +14,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
|||
* Redis 配置类
|
||||
*/
|
||||
@AutoConfiguration(before = RedissonAutoConfiguration.class) // 目的:使用自己定义的 RedisTemplate Bean
|
||||
public class YudaoRedisAutoConfiguration {
|
||||
public class YanzhuRedisAutoConfiguration {
|
||||
|
||||
/**
|
||||
* 创建 RedisTemplate Bean,使用 JSON 序列化方式
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration
|
||||
cn.iocoder.yudao.framework.redis.config.YudaoCacheAutoConfiguration
|
||||
com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration
|
||||
com.yanzhu.framework.redis.config.YanzhuCacheAutoConfiguration
|
||||
|
|
@ -24,7 +24,7 @@ import org.springframework.security.web.access.AccessDeniedHandler;
|
|||
/**
|
||||
* Spring Security 自动配置类,主要用于相关组件的配置
|
||||
*
|
||||
* 注意,不能和 {@link YudaoWebSecurityConfigurerAdapter} 用一个,原因是会导致初始化报错。
|
||||
* 注意,不能和 {@link Yanzhu} 用一个,原因是会导致初始化报错。
|
||||
* 参见 https://stackoverflow.com/questions/53847050/spring-boot-delegatebuilder-cannot-be-null-on-autowiring-authenticationmanager 文档。
|
||||
*
|
||||
* @author 研筑科技
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.yanzhu.framework.test.core.ut;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.yanzhu.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
||||
import com.yanzhu.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
||||
import com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.datasource.config.YanzhuDataSourceAutoConfiguration;
|
||||
import com.yanzhu.framework.mybatis.config.YanzhuMybatisAutoConfiguration;
|
||||
import com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.test.config.RedisTestConfiguration;
|
||||
import com.yanzhu.framework.test.config.SqlInitializationTestConfiguration;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
|
|
@ -31,18 +31,18 @@ public class BaseDbAndRedisUnitTest {
|
|||
|
||||
@Import({
|
||||
// DB 配置类
|
||||
YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类
|
||||
YanzhuDataSourceAutoConfiguration.class, // 自己的 DB 配置类
|
||||
DataSourceAutoConfiguration.class, // Spring DB 自动配置类
|
||||
DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类
|
||||
DruidDataSourceAutoConfigure.class, // Druid 自动配置类
|
||||
SqlInitializationTestConfiguration.class, // SQL 初始化
|
||||
// MyBatis 配置类
|
||||
YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
|
||||
YanzhuMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
|
||||
MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
|
||||
|
||||
// Redis 配置类
|
||||
RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
|
||||
YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
||||
YanzhuRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
||||
RedisAutoConfiguration.class, // Spring Redis 自动配置类
|
||||
RedissonAutoConfiguration.class, // Redisson 自动配置类
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.yanzhu.framework.test.core.ut;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.yanzhu.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
||||
import com.yanzhu.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
||||
import com.yanzhu.framework.datasource.config.YanzhuDataSourceAutoConfiguration;
|
||||
import com.yanzhu.framework.mybatis.config.YanzhuMybatisAutoConfiguration;
|
||||
import com.yanzhu.framework.test.config.SqlInitializationTestConfiguration;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||
|
|
@ -28,13 +28,13 @@ public class BaseDbUnitTest {
|
|||
|
||||
@Import({
|
||||
// DB 配置类
|
||||
YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类
|
||||
YanzhuDataSourceAutoConfiguration.class, // 自己的 DB 配置类
|
||||
DataSourceAutoConfiguration.class, // Spring DB 自动配置类
|
||||
DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类
|
||||
DruidDataSourceAutoConfigure.class, // Druid 自动配置类
|
||||
SqlInitializationTestConfiguration.class, // SQL 初始化
|
||||
// MyBatis 配置类
|
||||
YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
|
||||
YanzhuMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
|
||||
MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
|
||||
MybatisPlusJoinAutoConfiguration.class, // MyBatis 的Join配置类
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.yanzhu.framework.test.core.ut;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.yanzhu.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.redis.config.YanzhuRedisAutoConfiguration;
|
||||
import com.yanzhu.framework.test.config.RedisTestConfiguration;
|
||||
import org.redisson.spring.starter.RedissonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
|
|
@ -23,8 +23,8 @@ public class BaseRedisUnitTest {
|
|||
@Import({
|
||||
// Redis 配置类
|
||||
RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
|
||||
YanzhuRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
||||
RedisAutoConfiguration.class, // Spring Redis 自动配置类
|
||||
YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
|
||||
RedissonAutoConfiguration.class, // Redisson 自动配置类
|
||||
|
||||
// 其它配置类
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
|
||||
import static com.yanzhu.framework.web.config.YudaoWebAutoConfiguration.createFilterBean;
|
||||
import static com.yanzhu.framework.web.config.YanzhuWebAutoConfiguration.createFilterBean;
|
||||
|
||||
@AutoConfiguration
|
||||
@Slf4j
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class WebProperties {
|
|||
* 意义:通过该前缀,避免 Swagger、Actuator 意外通过 Nginx 暴露出来给外部,带来安全性问题
|
||||
* 这样,Nginx 只需要配置转发到 /api/* 的所有接口即可。
|
||||
*
|
||||
* @see YudaoWebAutoConfiguration#configurePathMatch(PathMatchConfigurer)
|
||||
* @see Yanzhu#configurePathMatch(PathMatchConfigurer)
|
||||
*/
|
||||
@NotEmpty(message = "API 前缀不能为空")
|
||||
private String prefix;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.util.PathMatcher;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import static com.yanzhu.framework.web.config.YudaoWebAutoConfiguration.createFilterBean;
|
||||
import static com.yanzhu.framework.web.config.YanzhuWebAutoConfiguration.createFilterBean;
|
||||
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(XssProperties.class)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.yanzhu.framework.websocket.config;
|
||||
|
||||
import com.yanzhu.framework.mq.redis.config.YudaoRedisMQConsumerAutoConfiguration;
|
||||
import com.yanzhu.framework.mq.redis.config.YanzhuRedisMQConsumerAutoConfiguration;
|
||||
import com.yanzhu.framework.mq.redis.core.RedisMQTemplate;
|
||||
import com.yanzhu.framework.websocket.core.handler.JsonWebSocketMessageHandler;
|
||||
import com.yanzhu.framework.websocket.core.listener.WebSocketMessageListener;
|
||||
|
|
@ -40,11 +40,11 @@ import java.util.List;
|
|||
*
|
||||
* @author xingyu4j
|
||||
*/
|
||||
@AutoConfiguration(before = YudaoRedisMQConsumerAutoConfiguration.class) // before YudaoRedisMQConsumerAutoConfiguration 的原因是,需要保证 RedisWebSocketMessageConsumer 先创建,才能创建 RedisMessageListenerContainer
|
||||
@AutoConfiguration(before = YanzhuRedisMQConsumerAutoConfiguration.class) // before YanzhuRedisMQConsumerAutoConfiguration 的原因是,需要保证 RedisWebSocketMessageConsumer 先创建,才能创建 RedisMessageListenerContainer
|
||||
@EnableWebSocket // 开启 websocket
|
||||
@ConditionalOnProperty(prefix = "yanzhu.websocket", value = "enable", matchIfMissing = true) // 允许使用 yanzhu.websocket.enable=false 禁用 websocket
|
||||
@EnableConfigurationProperties(WebSocketProperties.class)
|
||||
public class YudaoWebSocketAutoConfiguration {
|
||||
public class YanzhuWebSocketAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public WebSocketConfigurer webSocketConfigurer(HandshakeInterceptor[] handshakeInterceptors,
|
||||
|
|
@ -1 +1 @@
|
|||
cn.iocoder.yudao.framework.websocket.config.YudaoWebSocketAutoConfiguration
|
||||
com.yanzhu.framework.websocket.config.YanzhuWebSocketAutoConfiguration
|
||||
|
|
@ -42,7 +42,7 @@ import java.util.Optional;
|
|||
* @author fansili
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties({ YudaoAiProperties.class })
|
||||
@EnableConfigurationProperties({ YanzhuAiProperties.class })
|
||||
@Slf4j
|
||||
public class AiAutoConfiguration {
|
||||
|
||||
|
|
@ -56,12 +56,12 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.gemini.enable", havingValue = "true")
|
||||
public GeminiChatModel geminiChatModel(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.Gemini properties = yanzhuAiProperties.getGemini();
|
||||
public GeminiChatModel geminiChatModel(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.Gemini properties = yanzhuAiProperties.getGemini();
|
||||
return buildGeminiChatClient(properties);
|
||||
}
|
||||
|
||||
public GeminiChatModel buildGeminiChatClient(YudaoAiProperties.Gemini properties) {
|
||||
public GeminiChatModel buildGeminiChatClient(YanzhuAiProperties.Gemini properties) {
|
||||
if (StrUtil.isEmpty(properties.getModel())) {
|
||||
properties.setModel(GeminiChatModel.MODEL_DEFAULT);
|
||||
}
|
||||
|
|
@ -79,12 +79,12 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.doubao.enable", havingValue = "true")
|
||||
public DouBaoChatModel douBaoChatClient(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.DouBao properties = yanzhuAiProperties.getDoubao();
|
||||
public DouBaoChatModel douBaoChatClient(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.DouBao properties = yanzhuAiProperties.getDoubao();
|
||||
return buildDouBaoChatClient(properties);
|
||||
}
|
||||
|
||||
public DouBaoChatModel buildDouBaoChatClient(YudaoAiProperties.DouBao properties) {
|
||||
public DouBaoChatModel buildDouBaoChatClient(YanzhuAiProperties.DouBao properties) {
|
||||
if (StrUtil.isEmpty(properties.getModel())) {
|
||||
properties.setModel(DouBaoChatModel.MODEL_DEFAULT);
|
||||
}
|
||||
|
|
@ -102,12 +102,12 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.siliconflow.enable", havingValue = "true")
|
||||
public SiliconFlowChatModel siliconFlowChatClient(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.SiliconFlow properties = yanzhuAiProperties.getSiliconflow();
|
||||
public SiliconFlowChatModel siliconFlowChatClient(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.SiliconFlow properties = yanzhuAiProperties.getSiliconflow();
|
||||
return buildSiliconFlowChatClient(properties);
|
||||
}
|
||||
|
||||
public SiliconFlowChatModel buildSiliconFlowChatClient(YudaoAiProperties.SiliconFlow properties) {
|
||||
public SiliconFlowChatModel buildSiliconFlowChatClient(YanzhuAiProperties.SiliconFlow properties) {
|
||||
if (StrUtil.isEmpty(properties.getModel())) {
|
||||
properties.setModel(SiliconFlowApiConstants.MODEL_DEFAULT);
|
||||
}
|
||||
|
|
@ -125,12 +125,12 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.hunyuan.enable", havingValue = "true")
|
||||
public HunYuanChatModel hunYuanChatClient(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.HunYuan properties = yanzhuAiProperties.getHunyuan();
|
||||
public HunYuanChatModel hunYuanChatClient(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.HunYuan properties = yanzhuAiProperties.getHunyuan();
|
||||
return buildHunYuanChatClient(properties);
|
||||
}
|
||||
|
||||
public HunYuanChatModel buildHunYuanChatClient(YudaoAiProperties.HunYuan properties) {
|
||||
public HunYuanChatModel buildHunYuanChatClient(YanzhuAiProperties.HunYuan properties) {
|
||||
if (StrUtil.isEmpty(properties.getModel())) {
|
||||
properties.setModel(HunYuanChatModel.MODEL_DEFAULT);
|
||||
}
|
||||
|
|
@ -154,12 +154,12 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.xinghuo.enable", havingValue = "true")
|
||||
public XingHuoChatModel xingHuoChatClient(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.XingHuo properties = yanzhuAiProperties.getXinghuo();
|
||||
public XingHuoChatModel xingHuoChatClient(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.XingHuo properties = yanzhuAiProperties.getXinghuo();
|
||||
return buildXingHuoChatClient(properties);
|
||||
}
|
||||
|
||||
public XingHuoChatModel buildXingHuoChatClient(YudaoAiProperties.XingHuo properties) {
|
||||
public XingHuoChatModel buildXingHuoChatClient(YanzhuAiProperties.XingHuo properties) {
|
||||
if (StrUtil.isEmpty(properties.getModel())) {
|
||||
properties.setModel(XingHuoChatModel.MODEL_DEFAULT);
|
||||
}
|
||||
|
|
@ -179,12 +179,12 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.baichuan.enable", havingValue = "true")
|
||||
public BaiChuanChatModel baiChuanChatClient(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.BaiChuan properties = yanzhuAiProperties.getBaichuan();
|
||||
public BaiChuanChatModel baiChuanChatClient(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.BaiChuan properties = yanzhuAiProperties.getBaichuan();
|
||||
return buildBaiChuanChatClient(properties);
|
||||
}
|
||||
|
||||
public BaiChuanChatModel buildBaiChuanChatClient(YudaoAiProperties.BaiChuan properties) {
|
||||
public BaiChuanChatModel buildBaiChuanChatClient(YanzhuAiProperties.BaiChuan properties) {
|
||||
if (StrUtil.isEmpty(properties.getModel())) {
|
||||
properties.setModel(BaiChuanChatModel.MODEL_DEFAULT);
|
||||
}
|
||||
|
|
@ -202,25 +202,25 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.midjourney.enable", havingValue = "true")
|
||||
public MidjourneyApi midjourneyApi(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.Midjourney config = yanzhuAiProperties.getMidjourney();
|
||||
public MidjourneyApi midjourneyApi(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.Midjourney config = yanzhuAiProperties.getMidjourney();
|
||||
return new MidjourneyApi(config.getBaseUrl(), config.getApiKey(), config.getNotifyUrl());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.suno.enable", havingValue = "true")
|
||||
public SunoApi sunoApi(YudaoAiProperties yanzhuAiProperties) {
|
||||
public SunoApi sunoApi(YanzhuAiProperties yanzhuAiProperties) {
|
||||
return new SunoApi(yanzhuAiProperties.getSuno().getBaseUrl());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.grok.enable", havingValue = "true")
|
||||
public GrokChatModel grokChatClient(YudaoAiProperties yanzhuAiProperties) {
|
||||
YudaoAiProperties.Grok properties = yanzhuAiProperties.getGrok();
|
||||
public GrokChatModel grokChatClient(YanzhuAiProperties yanzhuAiProperties) {
|
||||
YanzhuAiProperties.Grok properties = yanzhuAiProperties.getGrok();
|
||||
return buildGrokChatClient(properties);
|
||||
}
|
||||
|
||||
public GrokChatModel buildGrokChatClient(YudaoAiProperties.Grok properties) {
|
||||
public GrokChatModel buildGrokChatClient(YanzhuAiProperties.Grok properties) {
|
||||
if (StrUtil.isEmpty(properties.getModel())) {
|
||||
properties.setModel(GrokChatModel.MODEL_DEFAULT);
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ public class AiAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "yanzhu.ai.web-search.enable", havingValue = "true")
|
||||
public AiWebSearchClient webSearchClient(YudaoAiProperties yanzhuAiProperties) {
|
||||
public AiWebSearchClient webSearchClient(YanzhuAiProperties yanzhuAiProperties) {
|
||||
return new AiBoChaWebSearchClient(yanzhuAiProperties.getWebSearch().getApiKey());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
*/
|
||||
@ConfigurationProperties(prefix = "yanzhu.ai")
|
||||
@Data
|
||||
public class YudaoAiProperties {
|
||||
public class YanzhuAiProperties {
|
||||
|
||||
/**
|
||||
* 谷歌 Gemini
|
||||
|
|
@ -4,7 +4,7 @@ import cn.hutool.core.lang.Singleton;
|
|||
import cn.hutool.core.lang.func.Func0;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yanzhu.module.ai.enums.model.AiPlatformEnum;
|
||||
import com.yanzhu.module.ai.framework.ai.config.YudaoAiProperties;
|
||||
import com.yanzhu.module.ai.framework.ai.config.YanzhuAiProperties;
|
||||
import com.yanzhu.module.ai.framework.ai.core.model.baichuan.BaiChuanChatModel;
|
||||
import com.yanzhu.module.ai.framework.ai.core.model.doubao.DouBaoChatModel;
|
||||
import com.yanzhu.module.ai.framework.ai.core.model.gemini.GeminiChatModel;
|
||||
|
|
@ -84,7 +84,7 @@ public class AiModelFactoryImpl implements AiModelFactory {
|
|||
public MidjourneyApi getOrCreateMidjourneyApi(String apiKey, String url) {
|
||||
String cacheKey = buildClientCacheKey(MidjourneyApi.class, AiPlatformEnum.MIDJOURNEY.getPlatform(), apiKey, url);
|
||||
return Singleton.get(cacheKey, (Func0<MidjourneyApi>) () -> {
|
||||
YudaoAiProperties.Midjourney properties = new YudaoAiProperties.Midjourney()
|
||||
YanzhuAiProperties.Midjourney properties = new YanzhuAiProperties.Midjourney()
|
||||
.setBaseUrl(url).setApiKey(apiKey);
|
||||
return new MidjourneyApi(url, apiKey, properties.getNotifyUrl());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.yanzhu.module.ai.framework.web.config;
|
||||
|
||||
import com.yanzhu.framework.swagger.config.YudaoSwaggerAutoConfiguration;
|
||||
import com.yanzhu.framework.swagger.config.YanzhuSwaggerAutoConfiguration;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -18,7 +18,7 @@ public class AiWebConfiguration {
|
|||
*/
|
||||
@Bean
|
||||
public GroupedOpenApi aiGroupedOpenApi() {
|
||||
return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("ai");
|
||||
return YanzhuSwaggerAutoConfiguration.buildGroupedOpenApi("ai");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.yanzhu.module.bpm.framework.web.config;
|
||||
|
||||
import com.yanzhu.framework.common.enums.WebFilterOrderEnum;
|
||||
import com.yanzhu.framework.swagger.config.YudaoSwaggerAutoConfiguration;
|
||||
import com.yanzhu.framework.swagger.config.YanzhuSwaggerAutoConfiguration;
|
||||
import com.yanzhu.module.bpm.framework.web.core.FlowableWebFilter;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
|
|
@ -21,7 +21,7 @@ public class BpmWebConfiguration {
|
|||
*/
|
||||
@Bean
|
||||
public GroupedOpenApi bpmGroupedOpenApi() {
|
||||
return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("bpm");
|
||||
return YanzhuSwaggerAutoConfiguration.buildGroupedOpenApi("bpm");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue