Spring Cloud构建微服务架构(一)——服务注册与发现

This commit is contained in:
程序猿DD
2016-05-31 21:38:15 +08:00
parent 3e98eace74
commit 469798e649
4 changed files with 26 additions and 18 deletions
+19 -5
View File
@@ -12,9 +12,10 @@
<description>Spring Cloud project</description>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>1.0.0.RELEASE</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
@@ -25,8 +26,9 @@
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -35,6 +37,18 @@
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
@@ -4,8 +4,8 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
@SpringBootApplication
public class Application {
public static void main(String[] args) {
@@ -0,0 +1,6 @@
server.port=1111
#eureka.instance.hostname=localhost
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
@@ -1,12 +0,0 @@
# 配置应用服务器(Tomcat)
server:
port: 1111 # HTTP端口
# 配置发现服务器(Discovery Server)
eureka:
instance:
hostname: localhost
client: # 不是客户端,所以不注册自己
registerWithEureka: false
fetchRegistry: false