Я новичок в Spring Boot и следил за учебником, где используется Forwebclient. В приведенном ниже коде я получаю ошибку, что ForwebClient устарел. Как изменить код, который работает этот код, как это должно быть. Ошибка, которую я получаю, «не может разрешить метод» Forwebclient 'в «WebClientAdapter» », а весенняя версия - 3.4.4. < /P>
package com.dailycodebuffer.department_service.config;
import com.dailycodebuffer.department_service.client.EmployeeClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.reactive.LoadBalancedExchangeFilterFunction;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.support.WebClientAdapter;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;
@Configuration
public class WebClientConfig {
@Autowired
private LoadBalancedExchangeFilterFunction filterFunction;
@Bean
public WebClient employeeWebClient() {
return WebClient.builder()
.baseUrl("http://employee-service")
.filter(filterFunction)
.build();
}
@Bean
public EmployeeClient employeeClient() {
HttpServiceProxyFactory httpServiceProxyFactory
= HttpServiceProxyFactory
.builder(WebClientAdapter.forClient(employeeWebClient()))
.build();
return httpServiceProxyFactory.createClient(EmployeeClient.class);
}
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... ing-boot-6