1,配置文件名必须要带有properties后缀名;
application-server1.properties
application-server2.properties
2,在主配置文件找那个使用spring.profiles.active属性指定加载的配置文件
server.port=1111 spring.profiles.active=server1 eureka.instance.hostname=localhost eureka.client.register-with-eureka=false eureka.client.fetch-registry=false eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka
3,在其他配置文件中指定不同的端口号或IP地址
server.port=1112 eureka.instance.hostname=localhost eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka