0

Here is my application.properties:

spring.application.name=person

server.port=8080
eureka.client.service-url.defaultZone=http://localhost:8761/eureka

# this line of config doesn't work    
person.ribbon.NFLoadBalancerRuleClassName=asdfasdfasdf

By setting person.ribbon.NFLoadBalancerRuleClassName to asdfasdfasdf there should be some errors shown in console output but there's none, which means this config doesn't work. I cannot tell what's going on.

Here are the dependencies:

<dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka-server</artifactId>
        </dependency>



        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-feign</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-ribbon</artifactId>
        </dependency>

    </dependencies>

The version of spring-cloud is Brixton.SR3,

4

1 回答 1

1

I successfully configured Ribbon with following configuration class:

@Configuration
@RibbonClient(name = "person", configuration = RibbonConfiguration.RibbonConfig.class)
public class RibbonConfiguration {
    static class RibbonConfig {
        @Bean
        public IRule rule() {
            return new WeightedResponseTimeRule();
        }
    }
}
于 2016-08-06T06:35:37.017 回答