增加服务发现注册功能

This commit is contained in:
zhouxiunai
2019-01-14 10:58:19 +08:00
parent 9e7d9aca77
commit 33c63274d5
4 changed files with 29 additions and 1 deletions
+18
View File
@@ -22,6 +22,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<spring-cloud.version>Edgware.SR5</spring-cloud.version>
</properties> </properties>
<dependencies> <dependencies>
@@ -138,6 +139,12 @@
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
@@ -184,4 +191,15 @@
</resources> </resources>
</build> </build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project> </project>
@@ -2,10 +2,12 @@ package com.gzzn.omms.msgexchangeapi;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@EnableScheduling @EnableScheduling
@EnableEurekaClient
public class MsgexchangeApiApplication { public class MsgexchangeApiApplication {
public static void main(String[] args) { public static void main(String[] args) {
+7 -1
View File
@@ -84,4 +84,10 @@ elasticsearch:
pool: 5 pool: 5
#注意cluster.name需要与config/elasticsearch.yml中的cluster.name一致 #注意cluster.name需要与config/elasticsearch.yml中的cluster.name一致
cluster: cluster:
name: docker-cluster name: docker-cluster
eureka:
client:
service-url:
defaultZone: http://130.120.3.231:94/eureka/
instance:
prefer-ip-address: true
+2
View File
@@ -1,3 +1,5 @@
spring: spring:
application:
name: msgexchangeapi
profiles: profiles:
active: dev active: dev