Commit 1de3455c by Nepxion

重构XML

parent b9305d9a
...@@ -22,16 +22,16 @@ public class DiscoveryConfigurationLoader extends AbstractConfigurationLoader { ...@@ -22,16 +22,16 @@ public class DiscoveryConfigurationLoader extends AbstractConfigurationLoader {
@Override @Override
public InputStream getRemoteInputStream() throws IOException { public InputStream getRemoteInputStream() throws IOException {
// 本地文件模拟代替远程文件 // 本地文件模拟代替远程文件
return getInputStream("src/main/resources/discovery1.xml"); return getInputStream("src/main/resources/plugin1.xml");
} }
@Override @Override
protected String getLocalContextPath() { protected String getLocalContextPath() {
// 配置文件放在resources目录下 // 配置文件放在resources目录下
return "classpath:discovery1.xml"; return "classpath:plugin1.xml";
// 配置文件放在工程根目录下 // 配置文件放在工程根目录下
// return "file:discovery1.xml"; // return "file:plugin1.xml";
} }
private InputStream getInputStream(String fileName) { private InputStream getInputStream(String fileName) {
......
...@@ -38,7 +38,7 @@ public class DiscoveryConfigurationSimulator { ...@@ -38,7 +38,7 @@ public class DiscoveryConfigurationSimulator {
public void run() { public void run() {
// 本地文件模拟代替远程文件,随机读取 // 本地文件模拟代替远程文件,随机读取
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/plugin" + index + ".xml");
configurationPublisher.publish(inputStream); configurationPublisher.publish(inputStream);
} }
}, 10000L, 15000L); }, 10000L, 15000L);
......
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