1. 替换原始 code 签名
2. 服务与模块生成器,支持指定起始端口批量端口分配
(cherry picked from commit e99da38fd4)
This commit is contained in:
@@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.env.core.util.EnvUtils.HOST_NAME_VALUE;
|
||||
* 多环境的 {@link EnvEnvironmentPostProcessor} 实现类
|
||||
* 将 yudao.env.tag 设置到 nacos 等组件对应的 tag 配置项,当且仅当它们不存在时
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class EnvEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
/**
|
||||
* 环境配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "yudao.env")
|
||||
@Data
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
/**
|
||||
* 多环境的 RPC 组件的自动配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(EnvProperties.class)
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.context.annotation.Bean;
|
||||
/**
|
||||
* 多环境的 Web 组件的自动配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
/**
|
||||
* 开发环境上下文
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class EnvContextHolder {
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
* 多环境的 {@link org.springframework.cloud.client.loadbalancer.LoadBalancerClient} 实现类
|
||||
* 在从服务实例列表选择时,优先选择 tag 匹配的服务实例
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
|
||||
* 多环境的 {@link LoadBalancerClientFactory} 实现类
|
||||
* 目的:在创建 {@link ReactiveLoadBalancer} 时,会额外增加 {@link EnvLoadBalancerClient} 代理,用于 tag 过滤服务实例
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class EnvLoadBalancerClientFactory extends LoadBalancerClientFactory {
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import feign.RequestTemplate;
|
||||
/**
|
||||
* 多环境的 {@link RequestInterceptor} 实现类:Feign 请求时,将 tag 设置到 header 中,继续透传给被调用的服务
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class EnvRequestInterceptor implements RequestInterceptor {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Objects;
|
||||
/**
|
||||
* 环境 Utils
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class EnvUtils {
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.io.IOException;
|
||||
* 环境的 {@link jakarta.servlet.Filter} 实现类
|
||||
* 当有 tag 请求头时,设置到 {@link EnvContextHolder} 的标签上下文
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class EnvWebFilter extends OncePerRequestFilter {
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
* 开发环境拓展,实现类似阿里的特性环境的能力
|
||||
* 1. https://segmentfault.com/a/1190000018022987
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
package cn.iocoder.yudao.framework.env;
|
||||
|
||||
Reference in New Issue
Block a user