- Обслуживание сотрудников
- Обслуживание отдела
< li>Служба проекта.
Код: Выделить всё
@Autowired
private LoadBalancedExchangeFilterFunction filterFunction;
@Bean
public WebClient departmentWebClient() {
return WebClient.builder()
.baseUrl("http://department-service")
.filter(filterFunction)
.build();
}
@Bean
public DepartmentClient departmentClient() {
HttpServiceProxyFactory httpServiceProxyFactory
= HttpServiceProxyFactory
.builder(WebClientAdapter.forClient(departmentWebClient()))
.build();
return httpServiceProxyFactory.createClient(DepartmentClient.class);
}
@Bean
public WebClient projectWebClient() {
return WebClient.builder()
.baseUrl("http://project-service")
.filter(filterFunction)
.build();
}
@Bean
public TaskClient taskClient() {
HttpServiceProxyFactory httpServiceProxyFactory
= HttpServiceProxyFactory
.builder(WebClientAdapter.forClient(projectWebClient()))
.build();
return httpServiceProxyFactory.createClient(TaskClient.class);
}
Может ли кто-нибудь подсказать мне, как лучше всего добиться этого, возможно, с помощью примеров кода?
Подробнее здесь: https://stackoverflow.com/questions/785 ... g-boot-mic