yml 的一个略微反人类的用法。使用三个横线区分多个文件java
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/
至关于spring
applicationapp
spring: application: name: microservice-discovery-eureka-ha
application.peer1code
############### 指定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/
application.peer2server
############### 指定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/