Commit 440779bc by Spencer Gibb

Revert "attempt ordering of RibbonClients.defaultConfiguration's"

This reverts commit 0d468b39.
parent 0d468b39
......@@ -39,7 +39,7 @@ public class RibbonClientConfigurationRegistrar implements ImportBeanDefinitionR
AnnotationAttributes[] clients = (AnnotationAttributes[]) attrs.get("value");
for (AnnotationAttributes client : clients) {
registerClientConfiguration(registry, getClientName(client),
client.get("configuration"), 0);
client.get("configuration"));
}
}
if (attrs != null && attrs.containsKey("defaultConfiguration")) {
......@@ -50,13 +50,13 @@ public class RibbonClientConfigurationRegistrar implements ImportBeanDefinitionR
name = "default." + metadata.getClassName();
}
registerClientConfiguration(registry, name,
attrs.get("defaultConfiguration"), attrs.get("defaultConfigurationOrder"));
attrs.get("defaultConfiguration"));
}
Map<String, Object> client = metadata.getAnnotationAttributes(
RibbonClient.class.getName(), true);
String name = getClientName(client);
if (name != null) {
registerClientConfiguration(registry, name, client.get("configuration"), 0);
registerClientConfiguration(registry, name, client.get("configuration"));
}
}
......@@ -76,12 +76,11 @@ public class RibbonClientConfigurationRegistrar implements ImportBeanDefinitionR
}
private void registerClientConfiguration(BeanDefinitionRegistry registry,
Object name, Object configuration, Object order) {
Object name, Object configuration) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder
.genericBeanDefinition(RibbonClientSpecification.class);
builder.addConstructorArgValue(name);
builder.addConstructorArgValue(configuration);
builder.addConstructorArgValue(order);
registry.registerBeanDefinition(name + ".RibbonClientSpecification",
builder.getBeanDefinition());
}
......
......@@ -30,10 +30,4 @@ public class RibbonClientSpecification {
private Class<?>[] configuration;
private int order;
public Integer order() {
return order;
}
}
......@@ -42,5 +42,4 @@ public @interface RibbonClients {
Class<?>[] defaultConfiguration() default {};
int defaultConfigurationOrder() default 0;
}
......@@ -16,14 +16,11 @@
package org.springframework.cloud.netflix.ribbon;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.springframework.beans.BeanUtils;
......@@ -128,19 +125,8 @@ public class SpringClientFactory implements DisposableBean, ApplicationContextAw
context.register(configuration);
}
}
List<Entry<String, RibbonClientSpecification>> entries = new ArrayList<>(this.configurations
.entrySet());
Collections.sort(entries, new Comparator<Entry<String, RibbonClientSpecification>>() {
@Override
public int compare(Entry<String, RibbonClientSpecification> o1, Entry<String, RibbonClientSpecification> o2) {
return o1.getValue().order().compareTo(o2.getValue().order());
}
});
for (Entry<String, RibbonClientSpecification> entry : entries) {
for (Entry<String, RibbonClientSpecification> entry : this.configurations
.entrySet()) {
if (entry.getKey().startsWith("default.")) {
for (Class<?> configuration : entry.getValue().getConfiguration()) {
context.register(configuration);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment