Skip to content

Commit

Permalink
Make sure loaders are ordered
Browse files Browse the repository at this point in the history
  • Loading branch information
andriy-dmytruk committed Dec 10, 2024
1 parent a77fb87 commit 163a195
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.micronaut.context.ProviderUtils;
import io.micronaut.context.annotation.Requires;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.order.Ordered;
import io.micronaut.core.util.StringUtils;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.annotation.ClientFilter;
Expand All @@ -33,6 +34,7 @@
import jakarta.inject.Provider;

import java.util.Collection;
import java.util.Comparator;
import java.util.List;

/**
Expand All @@ -45,7 +47,7 @@
final class KubernetesHttpClientFilter {

private Provider<KubeConfig> kubeConfigProvider;
private final Provider<Collection<KubernetesTokenLoader>> kubernetesTokenLoaders;
private final Provider<List<KubernetesTokenLoader>> kubernetesTokenLoaders;

KubernetesHttpClientFilter(Provider<KubeConfigLoader> kubeConfigLoader,
ApplicationContext applicationContext) {
Expand All @@ -54,7 +56,8 @@ final class KubernetesHttpClientFilter {
this.kubeConfigProvider = ProviderUtils.memoized(
() -> kubeConfigLoader.get().getKubeConfig());
this.kubernetesTokenLoaders = ProviderUtils.memoized(
() -> applicationContext.getBeansOfType(KubernetesTokenLoader.class));
() -> applicationContext.getBeansOfType(KubernetesTokenLoader.class)
.stream().sorted(Comparator.comparing(Ordered::getOrder)).toList());
}

@RequestFilter
Expand Down

0 comments on commit 163a195

Please sign in to comment.