yml配置文件之连接符(---)的使用
先看个例子:spring:application:name: cms-discovery-eureka-ha---spring:profiles: peer1server:port: 9092eureka:instance:hostname: peer1...
·
先看个例子:
spring: application: name: cms-discovery-eureka-ha --- spring: profiles: peer1 server: port: 9092 eureka: instance: hostname: peer1 client: serviceUrl: defaultZone: http://peer2:9093/eureka/ --- spring: profiles: peer2 server: port: 9093 eureka: instance: hostname: peer2 client: serviceUrl: defaultZone: http://peer1:9092/eureka/
使用方式:假如生成的包名为 cms-eureka-ha.jar
java -jar cms-eureka-ha.jar --spring.profiles.active=peer1
java -jar cms-eureka-ha.jar --spring.profiles.active=peer2
通过spring.profiles.active指定使用哪个profile启动。
推荐文章:https://my.oschina.net/u/2278977/blog/807958
更多推荐
已为社区贡献3条内容
所有评论(0)