Eureka Server

Eureka Server :

package com.xp.configserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.config.server.EnableConfigServer;

@SpringBootApplication
@EnableDiscoveryClient//注册到Eruake上
@EnableConfigServer//统一配置服务
public class ConfigServerApplication {

   public static void main(String[] args) {
      SpringApplication.run(ConfigServerApplication.class, args);
   }
}

application.yml

spring:
  application:
    name: configserver
  cloud:
    config:
      server:
        git:
          uri: https://gitlab-demo.com/1148072/config-rep.git
          username: 1148072
          password: xpttxsok123123
          basedir: /Users/xupan/Downloads/config/
      label: master


#指明了应用的URL
eureka:
  client:
    service-url:
      defaultZone: http://localhost:8888/eureka/

#指明了应用启动的端口号
server:
  port: 2222

方式二:

server.port: 8761
eureka.instance.hostname: localhost
eureka.client.registerWithEureka: false
eureka.client.fetchRegistry: false
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

猜你喜欢

转载自my.oschina.net/u/2253438/blog/1824305