-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pavel Jareš <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...ervice/src/main/java/org/zowe/apiml/gateway/config/DiscoveryClientOrderProcessorBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
*/ | ||
|
||
package org.zowe.apiml.gateway.config; | ||
|
||
import com.netflix.discovery.EurekaClient; | ||
import org.springframework.beans.BeansException; | ||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; | ||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; | ||
import org.springframework.cloud.client.discovery.DiscoveryClient; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Arrays; | ||
import java.util.stream.Stream; | ||
|
||
@Component | ||
public class DiscoveryClientOrderProcessorBean implements BeanFactoryPostProcessor { | ||
|
||
@Override | ||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { | ||
Stream.of(DiscoveryClient.class, EurekaClient.class) | ||
.map(beanFactory::getBeanNamesForType) | ||
.flatMap(Arrays::stream) | ||
.distinct() | ||
.map(beanFactory::getBeanDefinition) | ||
.forEach(bd -> bd.setDependsOn("gatewayLoadBalancerClientFilter")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters