配置springCloud消费者

server.port =9000
spring.application.name =Server-Consumer
eureka.client.serviceUrl.defaultZone = http://peer1:8080/eureka/,http://peer2:8081/eureka/
//这三个注解可以用@SpringCloudApplication代替
@SpringBootApplication
@EnableDiscoveryClient
@EnableHystrix
public class ConsumerApplication {

    @Bean
//客户端负载均衡的注解
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }




    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

}

    
        
            org.springframework.cloud
            spring-cloud-dependencies
            Edgware.SR3
            pom
            import
        
    


    
        org.springframework.cloud
        spring-cloud-starter-eureka
    
    
        org.springframework.boot
        spring-boot-starter
    
    
        org.springframework.cloud
        spring-cloud-starter-ribbon
    

    
        org.springframework.boot
        spring-boot-starter-actuator
    

    
        org.springframework.cloud
        spring-cloud-starter-hystrix
    

你可能感兴趣的:(springCloud)