yml文件教程

地址:http://www.ruanyifeng.com/blog/2016/07/yaml.html

原来三个横线(---)是用来区分多个文件的,像下面就是指定了两个配置。

spring:
  application:
    name: microservice-discovery-eureka-ha
---
############### 指定profile=peer1
spring:
  profiles: peer1

server:
  port: 8761
eureka:
  instance:
  ## 当profile=peer1时,hostname=peer1
    hostname: peer1
  client:
    ### 将自己注册到peer2这个Eureka上
    serviceUrl:
      defaultZone: http://peer2:8762/eureka/
---
############### 指定profile=peer2
spring:
  profiles: peer2

server:
  port: 8762
eureka:
  instance:
    ## 当profile=peer2时,hostname=peer2
    hostname: peer2
  client:
    ### 将自己注册到peer1这个Eureka上
    serviceUrl:
      defaultZone: http://peer1:8761/eureka/

 

posted @ 2018-07-13 10:25  烟味i  阅读(421)  评论(0编辑  收藏  举报