Commit e1bd565d by Nepxion

取消必须提供ConfigLoader的限制

parent 51c7434b
......@@ -33,13 +33,16 @@ import com.nepxion.eventbus.core.Event;
public class ConfigSubscriber {
private static final Logger LOG = LoggerFactory.getLogger(ConfigSubscriber.class);
@Value("${" + PluginConstant.SPRING_APPLICATION_REGISTER_CONTROL_ENABLED + ":true}")
private Boolean registerControlEnabled;
@Value("${" + PluginConstant.SPRING_APPLICATION_DISCOVERY_CONTROL_ENABLED + ":true}")
private Boolean discoveryControlEnabled;
@Value("${" + ConfigConstant.SPRING_APPLICATION_DISCOVERY_REMOTE_CONFIG_ENABLED + ":true}")
private Boolean remoteConfigEnabled;
@Autowired
@Autowired(required = false)
private ConfigLoader configLoader;
@Autowired
......@@ -47,6 +50,18 @@ public class ConfigSubscriber {
@PostConstruct
public void initialize() {
if (!registerControlEnabled && !discoveryControlEnabled) {
LOG.info("********** Register and Discovery controls are all disabled, ignore to initialize **********");
return;
}
if (configLoader == null) {
LOG.info("********** ConfigLoader isn't provided, ignore to initialize **********");
return;
}
LOG.info("********** {} config starts to initialize **********", remoteConfigEnabled ? "Remote" : "Local");
InputStream inputStream = null;
......
......@@ -45,6 +45,6 @@
<version>
<!-- 表示消费端服务a的1.0,允许访问提供端服务b的1.0和1.1版本 -->
<service consumer-service-name="discovery-springcloud-example-a" provider-service-name="discovery-springcloud-example-b" consumer-version-value="1.0" provider-version-value="1.0,1.1"/>
</version>
</version>
</discovery>
</rule>
\ No newline at end of file
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