Commit 223d0953 by Nepxion

重构类结构

parent 2589884e
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>discovery-plugin-configuration</artifactId>
<name>Nepxion Discovery Plugin Configuration</name>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<description>Nepxion Discovery is an enhancement for Spring Cloud Discovery</description>
<url>http://www.nepxion.com</url>
<parent>
<groupId>com.nepxion</groupId>
<artifactId>discovery</artifactId>
<version>1.0.0</version>
</parent>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>discovery-plugin-core</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>eventbus-aop</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.nepxion.discovery.plugin.config; package com.nepxion.discovery.plugin.configuration;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -21,17 +21,17 @@ import org.slf4j.Logger; ...@@ -21,17 +21,17 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.discovery.plugin.constant.DiscoveryPluginConstant; import com.nepxion.discovery.plugin.configuration.constant.ConfigurationConstant;
import com.nepxion.discovery.plugin.entity.ConsumerEntity; import com.nepxion.discovery.plugin.configuration.xml.Dom4JParser;
import com.nepxion.discovery.plugin.entity.DiscoveryEntity; import com.nepxion.discovery.plugin.core.entity.ConsumerEntity;
import com.nepxion.discovery.plugin.entity.FilterEntity; import com.nepxion.discovery.plugin.core.entity.DiscoveryEntity;
import com.nepxion.discovery.plugin.entity.FilterType; import com.nepxion.discovery.plugin.core.entity.FilterEntity;
import com.nepxion.discovery.plugin.entity.VersionEntity; import com.nepxion.discovery.plugin.core.entity.FilterType;
import com.nepxion.discovery.plugin.exception.DiscoveryPluginException; import com.nepxion.discovery.plugin.core.entity.VersionEntity;
import com.nepxion.discovery.plugin.xml.Dom4JParser; import com.nepxion.discovery.plugin.core.exception.PluginException;
public class DiscoveryPluginConfigParser extends Dom4JParser { public class ConfigurationParser extends Dom4JParser {
private static final Logger LOG = LoggerFactory.getLogger(DiscoveryPluginConfigParser.class); private static final Logger LOG = LoggerFactory.getLogger(ConfigurationParser.class);
@Autowired @Autowired
private DiscoveryEntity discoveryEntity; private DiscoveryEntity discoveryEntity;
...@@ -44,14 +44,14 @@ public class DiscoveryPluginConfigParser extends Dom4JParser { ...@@ -44,14 +44,14 @@ public class DiscoveryPluginConfigParser extends Dom4JParser {
protected void parseRoot(Element element) { protected void parseRoot(Element element) {
LOG.info("Start to parse xml..."); LOG.info("Start to parse xml...");
int filterElementCount = element.elements(DiscoveryPluginConstant.FILTER_ELEMENT_NAME).size(); int filterElementCount = element.elements(ConfigurationConstant.FILTER_ELEMENT_NAME).size();
if (filterElementCount > 1) { if (filterElementCount > 1) {
throw new DiscoveryPluginException("The count of element[" + DiscoveryPluginConstant.FILTER_ELEMENT_NAME + "] can't be more than 1"); throw new PluginException("The count of element[" + ConfigurationConstant.FILTER_ELEMENT_NAME + "] can't be more than 1");
} }
int versionElementCount = element.elements(DiscoveryPluginConstant.VERSION_ELEMENT_NAME).size(); int versionElementCount = element.elements(ConfigurationConstant.VERSION_ELEMENT_NAME).size();
if (versionElementCount > 1) { if (versionElementCount > 1) {
throw new DiscoveryPluginException("The count of element[" + DiscoveryPluginConstant.VERSION_ELEMENT_NAME + "] can't be more than 1"); throw new PluginException("The count of element[" + ConfigurationConstant.VERSION_ELEMENT_NAME + "] can't be more than 1");
} }
FilterEntity filterEntity = new FilterEntity(); FilterEntity filterEntity = new FilterEntity();
...@@ -61,9 +61,9 @@ public class DiscoveryPluginConfigParser extends Dom4JParser { ...@@ -61,9 +61,9 @@ public class DiscoveryPluginConfigParser extends Dom4JParser {
if (childElementObject instanceof Element) { if (childElementObject instanceof Element) {
Element childElement = (Element) childElementObject; Element childElement = (Element) childElementObject;
if (StringUtils.equals(childElement.getName(), DiscoveryPluginConstant.FILTER_ELEMENT_NAME)) { if (StringUtils.equals(childElement.getName(), ConfigurationConstant.FILTER_ELEMENT_NAME)) {
parseFilter(childElement, filterEntity); parseFilter(childElement, filterEntity);
} else if (StringUtils.equals(childElement.getName(), DiscoveryPluginConstant.VERSION_ELEMENT_NAME)) { } else if (StringUtils.equals(childElement.getName(), ConfigurationConstant.VERSION_ELEMENT_NAME)) {
parseVersion(childElement, versionEntity); parseVersion(childElement, versionEntity);
} }
} }
...@@ -83,14 +83,14 @@ public class DiscoveryPluginConfigParser extends Dom4JParser { ...@@ -83,14 +83,14 @@ public class DiscoveryPluginConfigParser extends Dom4JParser {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private void parseFilter(Element element, FilterEntity filterEntity) { private void parseFilter(Element element, FilterEntity filterEntity) {
Attribute filterTypeAttribute = element.attribute(DiscoveryPluginConstant.FILTER_TYPE_ATTRIBUTE_NAME); Attribute filterTypeAttribute = element.attribute(ConfigurationConstant.FILTER_TYPE_ATTRIBUTE_NAME);
if (filterTypeAttribute == null) { if (filterTypeAttribute == null) {
throw new DiscoveryPluginException("Attribute[" + DiscoveryPluginConstant.FILTER_TYPE_ATTRIBUTE_NAME + "] in element[" + element.getName() + "] is missing"); throw new PluginException("Attribute[" + ConfigurationConstant.FILTER_TYPE_ATTRIBUTE_NAME + "] in element[" + element.getName() + "] is missing");
} }
String filterType = filterTypeAttribute.getData().toString().trim(); String filterType = filterTypeAttribute.getData().toString().trim();
filterEntity.setFilterType(FilterType.fromString(filterType)); filterEntity.setFilterType(FilterType.fromString(filterType));
Attribute globalFilterAttribute = element.attribute(DiscoveryPluginConstant.FILTER_VALUE_ATTRIBUTE_NAME); Attribute globalFilterAttribute = element.attribute(ConfigurationConstant.FILTER_VALUE_ATTRIBUTE_NAME);
if (globalFilterAttribute != null) { if (globalFilterAttribute != null) {
String globalFilterValue = globalFilterAttribute.getData().toString().trim(); String globalFilterValue = globalFilterAttribute.getData().toString().trim();
filterEntity.setFilterValue(globalFilterValue); filterEntity.setFilterValue(globalFilterValue);
...@@ -103,13 +103,13 @@ public class DiscoveryPluginConfigParser extends Dom4JParser { ...@@ -103,13 +103,13 @@ public class DiscoveryPluginConfigParser extends Dom4JParser {
if (childElementObject instanceof Element) { if (childElementObject instanceof Element) {
Element childElement = (Element) childElementObject; Element childElement = (Element) childElementObject;
Attribute serviceNameAttribute = childElement.attribute(DiscoveryPluginConstant.SERVICE_NAME_ATTRIBUTE_NAME); Attribute serviceNameAttribute = childElement.attribute(ConfigurationConstant.SERVICE_NAME_ATTRIBUTE_NAME);
if (serviceNameAttribute == null) { if (serviceNameAttribute == null) {
throw new DiscoveryPluginException("Attribute[" + DiscoveryPluginConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing"); throw new PluginException("Attribute[" + ConfigurationConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
} }
String serviceName = serviceNameAttribute.getData().toString().trim(); String serviceName = serviceNameAttribute.getData().toString().trim();
Attribute filterValueAttribute = childElement.attribute(DiscoveryPluginConstant.FILTER_VALUE_ATTRIBUTE_NAME); Attribute filterValueAttribute = childElement.attribute(ConfigurationConstant.FILTER_VALUE_ATTRIBUTE_NAME);
String filterValue = null; String filterValue = null;
if (filterValueAttribute != null) { if (filterValueAttribute != null) {
filterValue = filterValueAttribute.getData().toString().trim(); filterValue = filterValueAttribute.getData().toString().trim();
...@@ -128,9 +128,9 @@ public class DiscoveryPluginConfigParser extends Dom4JParser { ...@@ -128,9 +128,9 @@ public class DiscoveryPluginConfigParser extends Dom4JParser {
Element childElement = (Element) childElementObject; Element childElement = (Element) childElementObject;
ConsumerEntity consumerEntity = new ConsumerEntity(); ConsumerEntity consumerEntity = new ConsumerEntity();
Attribute serviceNameAttribute = childElement.attribute(DiscoveryPluginConstant.SERVICE_NAME_ATTRIBUTE_NAME); Attribute serviceNameAttribute = childElement.attribute(ConfigurationConstant.SERVICE_NAME_ATTRIBUTE_NAME);
if (serviceNameAttribute == null) { if (serviceNameAttribute == null) {
throw new DiscoveryPluginException("Attribute[" + DiscoveryPluginConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing"); throw new PluginException("Attribute[" + ConfigurationConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
} }
String serviceName = serviceNameAttribute.getData().toString().trim(); String serviceName = serviceNameAttribute.getData().toString().trim();
consumerEntity.setServiceName(serviceName); consumerEntity.setServiceName(serviceName);
...@@ -150,15 +150,15 @@ public class DiscoveryPluginConfigParser extends Dom4JParser { ...@@ -150,15 +150,15 @@ public class DiscoveryPluginConfigParser extends Dom4JParser {
if (childElementObject instanceof Element) { if (childElementObject instanceof Element) {
Element childElement = (Element) childElementObject; Element childElement = (Element) childElementObject;
Attribute serviceNameAttribute = childElement.attribute(DiscoveryPluginConstant.SERVICE_NAME_ATTRIBUTE_NAME); Attribute serviceNameAttribute = childElement.attribute(ConfigurationConstant.SERVICE_NAME_ATTRIBUTE_NAME);
if (serviceNameAttribute == null) { if (serviceNameAttribute == null) {
throw new DiscoveryPluginException("Attribute[" + DiscoveryPluginConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing"); throw new PluginException("Attribute[" + ConfigurationConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
} }
String serviceName = serviceNameAttribute.getData().toString().trim(); String serviceName = serviceNameAttribute.getData().toString().trim();
Attribute versionValueAttribute = childElement.attribute(DiscoveryPluginConstant.VERSION_VALUE_NAME_ATTRIBUTE_NAME); Attribute versionValueAttribute = childElement.attribute(ConfigurationConstant.VERSION_VALUE_NAME_ATTRIBUTE_NAME);
if (versionValueAttribute == null) { if (versionValueAttribute == null) {
throw new DiscoveryPluginException("Attribute[" + DiscoveryPluginConstant.VERSION_VALUE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing"); throw new PluginException("Attribute[" + ConfigurationConstant.VERSION_VALUE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
} }
String versionValue = versionValueAttribute.getData().toString().trim(); String versionValue = versionValueAttribute.getData().toString().trim();
......
package com.nepxion.discovery.plugin.config; package com.nepxion.discovery.plugin.configuration;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -16,7 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,7 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.eventbus.core.Event; import com.nepxion.eventbus.core.Event;
import com.nepxion.eventbus.core.EventControllerFactory; import com.nepxion.eventbus.core.EventControllerFactory;
public class DiscoveryPluginConfigPublisher { public class ConfigurationPublisher {
@Autowired @Autowired
private EventControllerFactory eventControllerFactory; private EventControllerFactory eventControllerFactory;
......
package com.nepxion.discovery.plugin.config; package com.nepxion.discovery.plugin.configuration;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -20,40 +20,40 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -20,40 +20,40 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.nepxion.discovery.plugin.constant.DiscoveryPluginConstant; import com.nepxion.discovery.plugin.configuration.constant.ConfigurationConstant;
import com.nepxion.discovery.plugin.exception.DiscoveryPluginException; import com.nepxion.discovery.plugin.configuration.loader.ConfigurationLoader;
import com.nepxion.discovery.plugin.loader.FileLoader; import com.nepxion.discovery.plugin.core.exception.PluginException;
import com.nepxion.eventbus.annotation.EventBus; import com.nepxion.eventbus.annotation.EventBus;
import com.nepxion.eventbus.core.Event; import com.nepxion.eventbus.core.Event;
@EventBus @EventBus
public class DiscoveryPluginConfigLoader { public class ConfigurationRetriever {
private static final Logger LOG = LoggerFactory.getLogger(DiscoveryPluginConfigLoader.class); private static final Logger LOG = LoggerFactory.getLogger(ConfigurationRetriever.class);
@Value("${" + DiscoveryPluginConstant.SPRING_APPLICATION_DISCOVERY_REMOTE_CONFIG_ENABLED + ":false}") @Value("${" + ConfigurationConstant.SPRING_APPLICATION_DISCOVERY_REMOTE_CONFIG_ENABLED + ":false}")
private Boolean remoteConfigEnabled; private Boolean remoteConfigEnabled;
@Autowired @Autowired
private FileLoader fileLoader; private ConfigurationLoader configurationLoader;
@Autowired @Autowired
private DiscoveryPluginConfigParser discoveryPluginConfigParser; private ConfigurationParser configurationParser;
public void initialize() throws DiscoveryPluginException { public void initialize() throws PluginException {
LOG.info("********** {} config starts to initialize **********", remoteConfigEnabled ? "Remote" : "Local"); LOG.info("********** {} config starts to initialize **********", remoteConfigEnabled ? "Remote" : "Local");
InputStream inputStream = null; InputStream inputStream = null;
try { try {
if (remoteConfigEnabled) { if (remoteConfigEnabled) {
inputStream = fileLoader.getRemoteInputStream(); inputStream = configurationLoader.getRemoteInputStream();
} else { } else {
inputStream = fileLoader.getLocalInputStream(); inputStream = configurationLoader.getLocalInputStream();
} }
parse(inputStream); parse(inputStream);
} catch (IOException e) { } catch (IOException e) {
throw new DiscoveryPluginException(e); throw new PluginException(e);
} catch (DocumentException e) { } catch (DocumentException e) {
throw new DiscoveryPluginException(e); throw new PluginException(e);
} finally { } finally {
if (inputStream != null) { if (inputStream != null) {
IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(inputStream);
...@@ -73,9 +73,9 @@ public class DiscoveryPluginConfigLoader { ...@@ -73,9 +73,9 @@ public class DiscoveryPluginConfigLoader {
try { try {
parse(inputStream); parse(inputStream);
} catch (IOException e) { } catch (IOException e) {
throw new DiscoveryPluginException(e); throw new PluginException(e);
} catch (DocumentException e) { } catch (DocumentException e) {
throw new DiscoveryPluginException(e); throw new PluginException(e);
} finally { } finally {
if (inputStream != null) { if (inputStream != null) {
IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(inputStream);
...@@ -85,9 +85,9 @@ public class DiscoveryPluginConfigLoader { ...@@ -85,9 +85,9 @@ public class DiscoveryPluginConfigLoader {
private void parse(InputStream inputStream) throws DocumentException, IOException { private void parse(InputStream inputStream) throws DocumentException, IOException {
if (inputStream == null) { if (inputStream == null) {
throw new DiscoveryPluginException("Failed to load " + (remoteConfigEnabled ? "remote" : "local") + " config, no input stream returns"); throw new PluginException("Failed to load " + (remoteConfigEnabled ? "remote" : "local") + " config, no input stream returns");
} }
discoveryPluginConfigParser.parse(inputStream); configurationParser.parse(inputStream);
} }
} }
\ No newline at end of file
package com.nepxion.discovery.plugin.configuration.config;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.nepxion.discovery.plugin.configuration.ConfigurationParser;
import com.nepxion.discovery.plugin.configuration.ConfigurationPublisher;
import com.nepxion.discovery.plugin.configuration.ConfigurationRetriever;
@Configuration
public class ConfigurationConfig {
@Autowired
private ConfigurationRetriever configurationRetriever;
@Bean
public ConfigurationParser configurationParser() {
return new ConfigurationParser();
}
@Bean
public ConfigurationRetriever configurationRetriever() {
return new ConfigurationRetriever();
}
@Bean
public ConfigurationPublisher configurationPoster() {
return new ConfigurationPublisher();
}
@PostConstruct
public void initialize() {
configurationRetriever.initialize();
}
}
\ No newline at end of file
package com.nepxion.discovery.plugin.constant; package com.nepxion.discovery.plugin.configuration.constant;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -9,13 +9,9 @@ package com.nepxion.discovery.plugin.constant; ...@@ -9,13 +9,9 @@ package com.nepxion.discovery.plugin.constant;
* @version 1.0 * @version 1.0
*/ */
public class DiscoveryPluginConstant { public class ConfigurationConstant {
public static final String SPRING_APPLICATION_DISCOVERY_VERSION_ENABLED = "spring.application.discovery.version.enabled";
public static final String SPRING_APPLICATION_DISCOVERY_REMOTE_CONFIG_ENABLED = "spring.application.discovery.remote.config.enabled"; public static final String SPRING_APPLICATION_DISCOVERY_REMOTE_CONFIG_ENABLED = "spring.application.discovery.remote.config.enabled";
public static final String SPRING_APPLICATION_NAME = "spring.application.name";
public static final String EUREKA_METADATA_VERSION = "version";
public static final String DISCOVERY_ELEMENT_NAME = "discovery"; public static final String DISCOVERY_ELEMENT_NAME = "discovery";
public static final String FILTER_ELEMENT_NAME = "filter"; public static final String FILTER_ELEMENT_NAME = "filter";
public static final String SERVICE_ELEMENT_NAME = "service"; public static final String SERVICE_ELEMENT_NAME = "service";
...@@ -26,6 +22,4 @@ public class DiscoveryPluginConstant { ...@@ -26,6 +22,4 @@ public class DiscoveryPluginConstant {
public static final String CONSUMER_ELEMENT_NAME = "consumer"; public static final String CONSUMER_ELEMENT_NAME = "consumer";
public static final String PROVIDER_ELEMENT_NAME = "provider"; public static final String PROVIDER_ELEMENT_NAME = "provider";
public static final String VERSION_VALUE_NAME_ATTRIBUTE_NAME = "version-value"; public static final String VERSION_VALUE_NAME_ATTRIBUTE_NAME = "version-value";
public static final String SEPARATE = ";";
} }
\ No newline at end of file
package com.nepxion.discovery.plugin.loader; package com.nepxion.discovery.plugin.configuration.loader;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -16,7 +16,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -16,7 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
public abstract class AbstractFileLoader implements FileLoader { public abstract class AbstractConfigurationLoader implements ConfigurationLoader {
@Autowired @Autowired
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
......
package com.nepxion.discovery.plugin.loader; package com.nepxion.discovery.plugin.configuration.loader;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -12,7 +12,7 @@ package com.nepxion.discovery.plugin.loader; ...@@ -12,7 +12,7 @@ package com.nepxion.discovery.plugin.loader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
public interface FileLoader { public interface ConfigurationLoader {
InputStream getLocalInputStream() throws IOException; InputStream getLocalInputStream() throws IOException;
InputStream getRemoteInputStream() throws IOException; InputStream getRemoteInputStream() throws IOException;
......
package com.nepxion.discovery.plugin.xml; package com.nepxion.discovery.plugin.configuration.xml;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.xml; package com.nepxion.discovery.plugin.configuration.xml;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.xml; package com.nepxion.discovery.plugin.configuration.xml;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.xml; package com.nepxion.discovery.plugin.configuration.xml;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>discovery-plugin</artifactId> <artifactId>discovery-plugin-core</artifactId>
<name>Nepxion Discovery Plugin</name> <name>Nepxion Discovery Plugin Core</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<description>Nepxion Discovery is an enhancement for Spring Cloud Discovery</description> <description>Nepxion Discovery is an enhancement for Spring Cloud Discovery</description>
...@@ -16,11 +16,6 @@ ...@@ -16,11 +16,6 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>eventbus-aop</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
...@@ -36,11 +31,6 @@ ...@@ -36,11 +31,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId> <artifactId>spring-cloud-starter-eureka</artifactId>
</dependency> </dependency>
......
package com.nepxion.discovery.plugin.config; package com.nepxion.discovery.plugin.core.config;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -11,36 +11,15 @@ package com.nepxion.discovery.plugin.config; ...@@ -11,36 +11,15 @@ package com.nepxion.discovery.plugin.config;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.nepxion.discovery.plugin.entity.DiscoveryEntity; import com.nepxion.discovery.plugin.core.entity.DiscoveryEntity;
import com.nepxion.discovery.plugin.strategy.FilterStrategy; import com.nepxion.discovery.plugin.core.strategy.FilterStrategy;
import com.nepxion.discovery.plugin.strategy.VersionStrategy; import com.nepxion.discovery.plugin.core.strategy.VersionStrategy;
@Configuration @Configuration
public class DiscoveryPluginConfig { public class PluginConfig {
@Autowired
private DiscoveryPluginConfigLoader discoveryPluginConfigLoader;
@Bean
public DiscoveryPluginConfigParser discoveryPluginConfigParser() {
return new DiscoveryPluginConfigParser();
}
@Bean
public DiscoveryPluginConfigLoader discoveryPluginConfigLoader() {
return new DiscoveryPluginConfigLoader();
}
@Bean
public DiscoveryPluginConfigPublisher discoveryPluginConfigPublisher() {
return new DiscoveryPluginConfigPublisher();
}
@Bean @Bean
public DiscoveryEntity discoveryEntity() { public DiscoveryEntity discoveryEntity() {
return new DiscoveryEntity(); return new DiscoveryEntity();
...@@ -60,9 +39,4 @@ public class DiscoveryPluginConfig { ...@@ -60,9 +39,4 @@ public class DiscoveryPluginConfig {
public VersionStrategy versionStrategy() { public VersionStrategy versionStrategy() {
return new VersionStrategy(); return new VersionStrategy();
} }
@PostConstruct
public void initialize() {
discoveryPluginConfigLoader.initialize();
}
} }
\ No newline at end of file
package com.nepxion.discovery.plugin.core.constant;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
public class PluginConstant {
public static final String SPRING_APPLICATION_DISCOVERY_VERSION_ENABLED = "spring.application.discovery.version.enabled";
public static final String SPRING_APPLICATION_NAME = "spring.application.name";
public static final String EUREKA_METADATA_VERSION = "version";
public static final String SEPARATE = ";";
}
\ No newline at end of file
package com.nepxion.discovery.plugin.context; package com.nepxion.discovery.plugin.core.context;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -17,10 +17,10 @@ import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceReg ...@@ -17,10 +17,10 @@ import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceReg
import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import com.nepxion.discovery.plugin.decorator.DiscoveryClientDecorator; import com.nepxion.discovery.plugin.core.decorator.DiscoveryClientDecorator;
import com.nepxion.discovery.plugin.decorator.EurekaServiceRegistryDecorator; import com.nepxion.discovery.plugin.core.decorator.EurekaServiceRegistryDecorator;
public class DiscoveryApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { public class PluginApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override @Override
public void initialize(ConfigurableApplicationContext applicationContext) { public void initialize(ConfigurableApplicationContext applicationContext) {
applicationContext.getBeanFactory().addBeanPostProcessor(new InstantiationAwareBeanPostProcessorAdapter() { applicationContext.getBeanFactory().addBeanPostProcessor(new InstantiationAwareBeanPostProcessorAdapter() {
......
package com.nepxion.discovery.plugin.decorator; package com.nepxion.discovery.plugin.core.decorator;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -16,8 +16,8 @@ import org.springframework.cloud.client.discovery.DiscoveryClient; ...@@ -16,8 +16,8 @@ import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
import com.nepxion.discovery.plugin.constant.DiscoveryPluginConstant; import com.nepxion.discovery.plugin.core.constant.PluginConstant;
import com.nepxion.discovery.plugin.strategy.VersionStrategy; import com.nepxion.discovery.plugin.core.strategy.VersionStrategy;
public class DiscoveryClientDecorator implements DiscoveryClient { public class DiscoveryClientDecorator implements DiscoveryClient {
private DiscoveryClient discoveryClient; private DiscoveryClient discoveryClient;
...@@ -45,9 +45,9 @@ public class DiscoveryClientDecorator implements DiscoveryClient { ...@@ -45,9 +45,9 @@ public class DiscoveryClientDecorator implements DiscoveryClient {
public List<ServiceInstance> getInstances(String serviceId) { public List<ServiceInstance> getInstances(String serviceId) {
List<ServiceInstance> instances = discoveryClient.getInstances(serviceId); List<ServiceInstance> instances = discoveryClient.getInstances(serviceId);
boolean discoveryVersionEnabled = Boolean.valueOf(environment.getProperty(DiscoveryPluginConstant.SPRING_APPLICATION_DISCOVERY_VERSION_ENABLED)); boolean discoveryVersionEnabled = Boolean.valueOf(environment.getProperty(PluginConstant.SPRING_APPLICATION_DISCOVERY_VERSION_ENABLED));
if (discoveryVersionEnabled) { if (discoveryVersionEnabled) {
String applicationName = environment.getProperty(DiscoveryPluginConstant.SPRING_APPLICATION_NAME); String applicationName = environment.getProperty(PluginConstant.SPRING_APPLICATION_NAME);
VersionStrategy versionStrategy = applicationContext.getBean(VersionStrategy.class); VersionStrategy versionStrategy = applicationContext.getBean(VersionStrategy.class);
versionStrategy.apply(applicationName, serviceId, instances); versionStrategy.apply(applicationName, serviceId, instances);
......
package com.nepxion.discovery.plugin.decorator; package com.nepxion.discovery.plugin.core.decorator;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -15,7 +15,7 @@ import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceReg ...@@ -15,7 +15,7 @@ import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceReg
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
import com.nepxion.discovery.plugin.strategy.FilterStrategy; import com.nepxion.discovery.plugin.core.strategy.FilterStrategy;
public class EurekaServiceRegistryDecorator extends EurekaServiceRegistry { public class EurekaServiceRegistryDecorator extends EurekaServiceRegistry {
private ServiceRegistry<EurekaRegistration> serviceRegistry; private ServiceRegistry<EurekaRegistration> serviceRegistry;
......
package com.nepxion.discovery.plugin.entity; package com.nepxion.discovery.plugin.core.entity;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.entity; package com.nepxion.discovery.plugin.core.entity;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.entity; package com.nepxion.discovery.plugin.core.entity;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.entity; package com.nepxion.discovery.plugin.core.entity;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.entity; package com.nepxion.discovery.plugin.core.entity;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
package com.nepxion.discovery.plugin.exception; package com.nepxion.discovery.plugin.core.exception;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -9,22 +9,22 @@ package com.nepxion.discovery.plugin.exception; ...@@ -9,22 +9,22 @@ package com.nepxion.discovery.plugin.exception;
* @version 1.0 * @version 1.0
*/ */
public class DiscoveryPluginException extends RuntimeException { public class PluginException extends RuntimeException {
private static final long serialVersionUID = 7975167663357170655L; private static final long serialVersionUID = 7975167663357170655L;
public DiscoveryPluginException() { public PluginException() {
super(); super();
} }
public DiscoveryPluginException(String message) { public PluginException(String message) {
super(message); super(message);
} }
public DiscoveryPluginException(String message, Throwable cause) { public PluginException(String message, Throwable cause) {
super(message, cause); super(message, cause);
} }
public DiscoveryPluginException(Throwable cause) { public PluginException(Throwable cause) {
super(cause); super(cause);
} }
} }
\ No newline at end of file
package com.nepxion.discovery.plugin.strategy; package com.nepxion.discovery.plugin.core.strategy;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -17,11 +17,11 @@ import org.slf4j.Logger; ...@@ -17,11 +17,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.discovery.plugin.constant.DiscoveryPluginConstant; import com.nepxion.discovery.plugin.core.constant.PluginConstant;
import com.nepxion.discovery.plugin.entity.DiscoveryEntity; import com.nepxion.discovery.plugin.core.entity.DiscoveryEntity;
import com.nepxion.discovery.plugin.entity.FilterEntity; import com.nepxion.discovery.plugin.core.entity.FilterEntity;
import com.nepxion.discovery.plugin.entity.FilterType; import com.nepxion.discovery.plugin.core.entity.FilterType;
import com.nepxion.discovery.plugin.exception.DiscoveryPluginException; import com.nepxion.discovery.plugin.core.exception.PluginException;
public class FilterStrategy { public class FilterStrategy {
private static final Logger LOG = LoggerFactory.getLogger(FilterStrategy.class); private static final Logger LOG = LoggerFactory.getLogger(FilterStrategy.class);
...@@ -50,7 +50,7 @@ public class FilterStrategy { ...@@ -50,7 +50,7 @@ public class FilterStrategy {
} }
if (StringUtils.isNotEmpty(filterValue)) { if (StringUtils.isNotEmpty(filterValue)) {
allFilter += StringUtils.isEmpty(allFilter) ? filterValue : DiscoveryPluginConstant.SEPARATE + filterValue; allFilter += StringUtils.isEmpty(allFilter) ? filterValue : PluginConstant.SEPARATE + filterValue;
} }
switch (filterType) { switch (filterType) {
...@@ -70,10 +70,10 @@ public class FilterStrategy { ...@@ -70,10 +70,10 @@ public class FilterStrategy {
private void validateBlacklist(String filterValue, String ipAddress) { private void validateBlacklist(String filterValue, String ipAddress) {
LOG.info("********** IP address blacklist={}, current ip address={} **********", filterValue, ipAddress); LOG.info("********** IP address blacklist={}, current ip address={} **********", filterValue, ipAddress);
String[] filterArray = StringUtils.split(filterValue, DiscoveryPluginConstant.SEPARATE); String[] filterArray = StringUtils.split(filterValue, PluginConstant.SEPARATE);
for (String filter : filterArray) { for (String filter : filterArray) {
if (ipAddress.startsWith(filter)) { if (ipAddress.startsWith(filter)) {
throw new DiscoveryPluginException(ipAddress + " isn't allowed to register to Eureka server, because it is in blacklist"); throw new PluginException(ipAddress + " isn't allowed to register to Eureka server, because it is in blacklist");
} }
} }
} }
...@@ -82,7 +82,7 @@ public class FilterStrategy { ...@@ -82,7 +82,7 @@ public class FilterStrategy {
LOG.info("********** IP address whitelist={}, current ip address={} **********", filterValue, ipAddress); LOG.info("********** IP address whitelist={}, current ip address={} **********", filterValue, ipAddress);
boolean valid = false; boolean valid = false;
String[] filterArray = StringUtils.split(filterValue, DiscoveryPluginConstant.SEPARATE); String[] filterArray = StringUtils.split(filterValue, PluginConstant.SEPARATE);
for (String filter : filterArray) { for (String filter : filterArray) {
if (ipAddress.startsWith(filter)) { if (ipAddress.startsWith(filter)) {
valid = true; valid = true;
...@@ -91,7 +91,7 @@ public class FilterStrategy { ...@@ -91,7 +91,7 @@ public class FilterStrategy {
} }
if (!valid) { if (!valid) {
throw new DiscoveryPluginException(ipAddress + " isn't allowed to register to Eureka server, because it isn't in whitelist"); throw new PluginException(ipAddress + " isn't allowed to register to Eureka server, because it isn't in whitelist");
} }
} }
} }
\ No newline at end of file
package com.nepxion.discovery.plugin.strategy; package com.nepxion.discovery.plugin.core.strategy;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
...@@ -19,10 +19,10 @@ import org.apache.commons.lang.StringUtils; ...@@ -19,10 +19,10 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.ServiceInstance;
import com.nepxion.discovery.plugin.constant.DiscoveryPluginConstant; import com.nepxion.discovery.plugin.core.constant.PluginConstant;
import com.nepxion.discovery.plugin.entity.ConsumerEntity; import com.nepxion.discovery.plugin.core.entity.ConsumerEntity;
import com.nepxion.discovery.plugin.entity.DiscoveryEntity; import com.nepxion.discovery.plugin.core.entity.DiscoveryEntity;
import com.nepxion.discovery.plugin.entity.VersionEntity; import com.nepxion.discovery.plugin.core.entity.VersionEntity;
public class VersionStrategy { public class VersionStrategy {
@Autowired @Autowired
...@@ -40,12 +40,12 @@ public class VersionStrategy { ...@@ -40,12 +40,12 @@ public class VersionStrategy {
if (consumerEntity != null) { if (consumerEntity != null) {
Map<String, String> providerMap = consumerEntity.getProviderMap(); Map<String, String> providerMap = consumerEntity.getProviderMap();
String version = providerMap.get(providerServiceId); String version = providerMap.get(providerServiceId);
String[] versionArray = StringUtils.split(version, DiscoveryPluginConstant.SEPARATE); String[] versionArray = StringUtils.split(version, PluginConstant.SEPARATE);
List<String> versionList = Arrays.asList(versionArray); List<String> versionList = Arrays.asList(versionArray);
Iterator<ServiceInstance> iterator = instances.iterator(); Iterator<ServiceInstance> iterator = instances.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServiceInstance serviceInstance = iterator.next(); ServiceInstance serviceInstance = iterator.next();
String metaDataVersion = serviceInstance.getMetadata().get(DiscoveryPluginConstant.EUREKA_METADATA_VERSION); String metaDataVersion = serviceInstance.getMetadata().get(PluginConstant.EUREKA_METADATA_VERSION);
if (!versionList.contains(metaDataVersion)) { if (!versionList.contains(metaDataVersion)) {
iterator.remove(); iterator.remove();
} }
......
package com.nepxion.discovery.plugin.util; package com.nepxion.discovery.plugin.core.util;
/** /**
* <p>Title: Nepxion Discovery</p> * <p>Title: Nepxion Discovery</p>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>discovery-plugin</artifactId> <artifactId>discovery-plugin-configuration</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
org.springframework.context.ApplicationContextInitializer=\ org.springframework.context.ApplicationContextInitializer=\
com.nepxion.discovery.plugin.context.DiscoveryApplicationContextInitializer com.nepxion.discovery.plugin.core.context.PluginApplicationContextInitializer
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.nepxion.discovery.plugin.config.DiscoveryPluginConfig com.nepxion.discovery.plugin.core.config.PluginConfig,\
\ No newline at end of file com.nepxion.discovery.plugin.configuration.config.ConfigurationConfig
\ No newline at end of file
...@@ -14,23 +14,23 @@ import org.springframework.boot.builder.SpringApplicationBuilder; ...@@ -14,23 +14,23 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import com.nepxion.discovery.plugin.example.impl.DiscoveryPluginConfigSimulator; import com.nepxion.discovery.plugin.example.impl.DiscoveryConfigurationSimulator;
import com.nepxion.discovery.plugin.example.impl.DiscoveryPluginFileLoader; import com.nepxion.discovery.plugin.example.impl.DiscoveryConfigurationLoader;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
public class DiscoveryPluginApplication { public class DiscoveryApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(DiscoveryPluginApplication.class).web(true).run(args); new SpringApplicationBuilder(DiscoveryApplication.class).web(true).run(args);
} }
@Bean @Bean
public DiscoveryPluginFileLoader discoveryPluginFileLoader() { public DiscoveryConfigurationLoader discoveryConfigurationLoader() {
return new DiscoveryPluginFileLoader(); return new DiscoveryConfigurationLoader();
} }
@Bean @Bean
public DiscoveryPluginConfigSimulator discoveryPluginConfigSimulator() { public DiscoveryConfigurationSimulator discoveryConfigurationSimulator() {
return new DiscoveryPluginConfigSimulator(); return new DiscoveryConfigurationSimulator();
} }
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
public class DiscoveryPluginController { public class DiscoveryController {
@Autowired @Autowired
private DiscoveryClient discoveryClient; private DiscoveryClient discoveryClient;
......
...@@ -15,10 +15,10 @@ import java.io.FileNotFoundException; ...@@ -15,10 +15,10 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import com.nepxion.discovery.plugin.loader.AbstractFileLoader; import com.nepxion.discovery.plugin.configuration.loader.AbstractConfigurationLoader;
// 模拟从本地配置或远程配置中心获取配置 // 模拟从本地配置或远程配置中心获取配置
public class DiscoveryPluginFileLoader extends AbstractFileLoader { public class DiscoveryConfigurationLoader extends AbstractConfigurationLoader {
@Override @Override
public InputStream getRemoteInputStream() throws IOException { public InputStream getRemoteInputStream() throws IOException {
// 本地文件模拟代替远程文件 // 本地文件模拟代替远程文件
......
...@@ -21,12 +21,12 @@ import javax.annotation.PostConstruct; ...@@ -21,12 +21,12 @@ import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.discovery.plugin.config.DiscoveryPluginConfigPublisher; import com.nepxion.discovery.plugin.configuration.ConfigurationPublisher;
// 模拟从远程配置中心接受配置更新 // 模拟从远程配置中心接受配置更新
public class DiscoveryPluginConfigSimulator { public class DiscoveryConfigurationSimulator {
@Autowired @Autowired
private DiscoveryPluginConfigPublisher discoveryPluginConfigPublisher; private ConfigurationPublisher configurationPublisher;
@PostConstruct @PostConstruct
public void initialize() { public void initialize() {
...@@ -39,7 +39,7 @@ public class DiscoveryPluginConfigSimulator { ...@@ -39,7 +39,7 @@ public class DiscoveryPluginConfigSimulator {
// 本地文件模拟代替远程文件,随机读取 // 本地文件模拟代替远程文件,随机读取
int index = threadLocalRandom.nextInt(4) + 1; int index = threadLocalRandom.nextInt(4) + 1;
InputStream inputStream = getInputStream("src/main/resources/discovery" + index + ".xml"); InputStream inputStream = getInputStream("src/main/resources/discovery" + index + ".xml");
discoveryPluginConfigPublisher.publish(inputStream); configurationPublisher.publish(inputStream);
} }
}, 10000L, 15000L); }, 10000L, 15000L);
} }
......
...@@ -15,8 +15,8 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; ...@@ -15,8 +15,8 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
public class DiscoveryPluginApplicationB1 { public class DiscoveryApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(DiscoveryPluginApplicationB1.class).web(true).run(args); new SpringApplicationBuilder(DiscoveryApplication.class).web(true).run(args);
} }
} }
\ No newline at end of file
...@@ -15,8 +15,8 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; ...@@ -15,8 +15,8 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
public class DiscoveryPluginApplicationB2 { public class DiscoveryApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(DiscoveryPluginApplicationB2.class).web(true).run(args); new SpringApplicationBuilder(DiscoveryApplication.class).web(true).run(args);
} }
} }
\ No newline at end of file
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<url>http://www.nepxion.com</url> <url>http://www.nepxion.com</url>
<modules> <modules>
<module>discovery-plugin</module> <module>discovery-plugin-core</module>
<module>discovery-plugin-configuration</module>
<module>discovery-plugin-starter</module> <module>discovery-plugin-starter</module>
<module>discovery-springcloud-example-a</module> <module>discovery-springcloud-example-a</module>
<module>discovery-springcloud-example-b1</module> <module>discovery-springcloud-example-b1</module>
...@@ -35,7 +36,13 @@ ...@@ -35,7 +36,13 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>discovery-plugin</artifactId> <artifactId>discovery-plugin-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>discovery-plugin-configuration</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
......
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