Commit 63e66324 by Nepxion

精简配置

parent 896a53f7
...@@ -25,17 +25,15 @@ import com.nepxion.discovery.plugin.strategy.extension.service.constant.ServiceS ...@@ -25,17 +25,15 @@ import com.nepxion.discovery.plugin.strategy.extension.service.constant.ServiceS
@AutoConfigureBefore(RibbonClientConfiguration.class) @AutoConfigureBefore(RibbonClientConfiguration.class)
@ConditionalOnProperty(value = StrategyConstant.SPRING_APPLICATION_STRATEGY_CONTROL_ENABLED, matchIfMissing = true) @ConditionalOnProperty(value = StrategyConstant.SPRING_APPLICATION_STRATEGY_CONTROL_ENABLED, matchIfMissing = true)
public class ServiceStrategyAutoConfiguration { public class ServiceStrategyAutoConfiguration {
@Value("${" + ServiceStrategyConstant.SPRING_APPLICATION_STRATEGY_BUSINESS_SCAN_PACKAGES + ":}") @Value("${" + ServiceStrategyConstant.SPRING_APPLICATION_STRATEGY_SCAN_PACKAGES + ":}")
private String scanPackages; private String scanPackages;
@Bean @Bean
@ConditionalOnProperty(value = ServiceStrategyConstant.SPRING_APPLICATION_STRATEGY_BUSINESS_CONTEXT_CONTROL_ENABLED, matchIfMissing = true)
public ServiceStrategyAutoScanProxy serviceStrategyAutoScanProxy() { public ServiceStrategyAutoScanProxy serviceStrategyAutoScanProxy() {
return new ServiceStrategyAutoScanProxy(scanPackages); return new ServiceStrategyAutoScanProxy(scanPackages);
} }
@Bean @Bean
@ConditionalOnProperty(value = ServiceStrategyConstant.SPRING_APPLICATION_STRATEGY_BUSINESS_CONTEXT_CONTROL_ENABLED, matchIfMissing = true)
public ServiceStrategyInterceptor serviceStrategyInterceptor() { public ServiceStrategyInterceptor serviceStrategyInterceptor() {
return new ServiceStrategyInterceptor(); return new ServiceStrategyInterceptor();
} }
......
...@@ -10,8 +10,7 @@ package com.nepxion.discovery.plugin.strategy.extension.service.constant; ...@@ -10,8 +10,7 @@ package com.nepxion.discovery.plugin.strategy.extension.service.constant;
*/ */
public class ServiceStrategyConstant { public class ServiceStrategyConstant {
public static final String SPRING_APPLICATION_STRATEGY_BUSINESS_CONTEXT_CONTROL_ENABLED = "spring.application.strategy.business.context.control.enabled"; public static final String SPRING_APPLICATION_STRATEGY_SCAN_PACKAGES = "spring.application.strategy.scan.packages";
public static final String SPRING_APPLICATION_STRATEGY_BUSINESS_SCAN_PACKAGES = "spring.application.strategy.business.scan.packages";
public static final String CLASS = "class"; public static final String CLASS = "class";
public static final String METHOD = "method"; public static final String METHOD = "method";
public static final String PARAMETER_MAP = "parameterMap"; public static final String PARAMETER_MAP = "parameterMap";
......
...@@ -44,7 +44,7 @@ spring.application.config.path=classpath:rule.xml ...@@ -44,7 +44,7 @@ spring.application.config.path=classpath:rule.xml
# spring.application.group.key=application # spring.application.group.key=application
# Plugin strategy config # Plugin strategy config
# 开启和关闭用户自定义和编程灰度路由策略的控制,包括跟业务无关(例如:不允许某个服务器的IP地址或者某个版本被负载均衡到)和业务数据有关(例如用户根据业务参数的不同,负载均衡到不同的服务器)。缺失则默认为true # 开启和关闭用户自定义和编程灰度路由策略的控制,例如用户根据业务参数的不同,负载均衡到不同的服务器。缺失则默认为true
spring.application.strategy.control.enabled=true spring.application.strategy.control.enabled=true
# Swagger config # Swagger config
......
...@@ -44,12 +44,10 @@ spring.application.config.path=classpath:rule.xml ...@@ -44,12 +44,10 @@ spring.application.config.path=classpath:rule.xml
# spring.application.group.key=application # spring.application.group.key=application
# Plugin strategy config # Plugin strategy config
# 开启和关闭用户自定义和编程灰度路由策略的控制,包括跟业务无关(例如:不允许某个服务器的IP地址或者某个版本被负载均衡到)和业务数据有关(例如用户根据业务参数的不同,负载均衡到不同的服务器)。缺失则默认为true # 开启和关闭用户自定义和编程灰度路由策略的控制,例如用户根据业务参数的不同,负载均衡到不同的服务器。缺失则默认为true
spring.application.strategy.control.enabled=true spring.application.strategy.control.enabled=true
# 开启和关闭用户自定义和编程灰度路由策略的业务有关性的控制(该设置只对服务有效,对网关无效)。一旦关闭,从业务接口无法把数据传递到上下文对象(StrategyContext);一旦开启,需要设置下面的scan.packages。缺失则默认为true # 用户自定义和编程灰度路由策略的时候,需要指定对业务Controller类的扫描路径,以便传递上下文对象。该项配置只对服务有效,对网关无效
spring.application.strategy.business.context.control.enabled=true spring.application.strategy.scan.packages=com.nepxion.discovery.plugin.example.service.feign
# 用户自定义和编程灰度路由策略的时候,需要指定对业务Controller类的扫描路径,以便传递上下文对象
spring.application.strategy.business.scan.packages=com.nepxion.discovery.plugin.example.service.feign
# Swagger config # Swagger config
swagger.service.base.package=com.nepxion.discovery.plugin.admincenter.endpoint swagger.service.base.package=com.nepxion.discovery.plugin.admincenter.endpoint
......
...@@ -44,7 +44,7 @@ spring.application.config.path=classpath:rule.xml ...@@ -44,7 +44,7 @@ spring.application.config.path=classpath:rule.xml
# spring.application.group.key=application # spring.application.group.key=application
# Plugin strategy config # Plugin strategy config
# 开启和关闭用户自定义和编程灰度路由策略的控制,包括跟业务无关(例如:不允许某个服务器的IP地址或者某个版本被负载均衡到)和业务数据有关(例如用户根据业务参数的不同,负载均衡到不同的服务器)。缺失则默认为true # 开启和关闭用户自定义和编程灰度路由策略的控制,例如用户根据业务参数的不同,负载均衡到不同的服务器。缺失则默认为true
spring.application.strategy.control.enabled=true spring.application.strategy.control.enabled=true
# Swagger config # Swagger config
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment