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/