This commit is contained in:
Olga Maciaszek-Sharma
2023-02-08 15:24:33 +01:00
parent da159123d4
commit 9b8d93e211
2 changed files with 42 additions and 1 deletions

View File

@@ -505,7 +505,10 @@ public class FeignClientFactoryBean
"Provide Feign client URL either in @FeignClient() or in config properties.");
}
return new HardCodedTarget(type, name, FeignClientsRegistrar.getUrl(config.getUrl()));
// TODO: create the appropriate target
return new PropertyBasedTarget(type, name, config);
// return new HardCodedTarget(type, name,
// FeignClientsRegistrar.getUrl(config.getUrl()));
}
private boolean isUrlAvailableInConfig(String contextId) {

View File

@@ -0,0 +1,38 @@
/*
* Copyright 2013-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.openfeign;
import feign.Target;
/**
* @author Olga Maciaszek-Sharma
*/
public class PropertyBasedTarget<T> extends Target.HardCodedTarget<T> {
private final FeignClientProperties.FeignClientConfiguration config;
public PropertyBasedTarget(Class<T> type, String name, FeignClientProperties.FeignClientConfiguration config) {
super(type, name, config.getUrl());
this.config = config;
}
@Override
public String url() {
return config.getUrl();
}
}