From 625242cb95be588aa5bd2de954557d5acf49ddc8 Mon Sep 17 00:00:00 2001 From: kklt1996 <18332763730@163.com> Date: Mon, 17 Jul 2017 04:57:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=EF=BC=8C=E6=B3=A8=E5=86=8C=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=BB=8E=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=AD=E5=BF=83=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + eureka-server/.gitignore | 31 ++++++++ eureka-server/pom.xml | 73 +++++++++++++++++++ .../server/EurekaServerApplication.java | 14 ++++ .../src/main/resources/bootstrap.yml | 8 ++ .../server/EurekaServerApplicationTests.java | 16 ++++ 6 files changed, 143 insertions(+) create mode 100644 eureka-server/.gitignore create mode 100644 eureka-server/pom.xml create mode 100644 eureka-server/src/main/java/com/micro/fast/eureka/server/EurekaServerApplication.java create mode 100644 eureka-server/src/main/resources/bootstrap.yml create mode 100644 eureka-server/src/test/java/com/micro/fast/eureka/server/EurekaServerApplicationTests.java diff --git a/README.md b/README.md index 11124ff..0295530 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ ###配置中心 端口号 10001 +###注册中心 端口号 10002 diff --git a/eureka-server/.gitignore b/eureka-server/.gitignore new file mode 100644 index 0000000..8c1680a --- /dev/null +++ b/eureka-server/.gitignore @@ -0,0 +1,31 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +### maven ### +target +out +.mvn +mvnw +mvnw.cmd diff --git a/eureka-server/pom.xml b/eureka-server/pom.xml new file mode 100644 index 0000000..9901ce6 --- /dev/null +++ b/eureka-server/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + com.micro.fast.eureka.server + eureka-server + 0.0.1-SNAPSHOT + jar + + eureka-server + eureka-server + + + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + Dalston.SR1 + 1.8 + 1.8 + 1.8 + + + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-eureka-server + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/eureka-server/src/main/java/com/micro/fast/eureka/server/EurekaServerApplication.java b/eureka-server/src/main/java/com/micro/fast/eureka/server/EurekaServerApplication.java new file mode 100644 index 0000000..fe48fea --- /dev/null +++ b/eureka-server/src/main/java/com/micro/fast/eureka/server/EurekaServerApplication.java @@ -0,0 +1,14 @@ +package com.micro.fast.eureka.server; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@SpringBootApplication +@EnableEurekaServer //开启注册中心相关服务 +public class EurekaServerApplication { + + public static void main(String[] args) { + SpringApplication.run(EurekaServerApplication.class, args); + } +} diff --git a/eureka-server/src/main/resources/bootstrap.yml b/eureka-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..63e8596 --- /dev/null +++ b/eureka-server/src/main/resources/bootstrap.yml @@ -0,0 +1,8 @@ +#从配置中心加载配置文件,启动eureka-server服务 +spring: + cloud: + config: + uri: http://localhost:10001/ + profile: dev + label: master + name: eureka-server diff --git a/eureka-server/src/test/java/com/micro/fast/eureka/server/EurekaServerApplicationTests.java b/eureka-server/src/test/java/com/micro/fast/eureka/server/EurekaServerApplicationTests.java new file mode 100644 index 0000000..ab72f53 --- /dev/null +++ b/eureka-server/src/test/java/com/micro/fast/eureka/server/EurekaServerApplicationTests.java @@ -0,0 +1,16 @@ +package com.micro.fast.eureka.server; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class EurekaServerApplicationTests { + + @Test + public void contextLoads() { + } + +}