I am trying to use FeignClient to connect to a REST service in a Spring Boot application. But the service is failing to load. Please find the details below and suggest.
I am using <spring-cloud.version>2021.0.8</spring-cloud.version>
**pom.xml**
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
@FeignClient(value = "SpringBootREST2", url = "http://localhost:9050/orders/v1/getMovieDetails/{movieId}")
public interface RestFeignService {
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
Movie getMovieDetailsFeign(@PathVariable("movieId") Integer movieId);
}
@SpringBootApplication
@EnableFeignClients
public class SpringCloudFeignApplication implements CommandLineRunner{
@Autowired
private RestFeignService restFeignService;
public static void main(String[] args) {
SpringApplication.run(SpringCloudFeignApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
Movie movie = restFeignService.getMovieDetailsFeign(100);
System.out.println(movie);
}
}
Exception Caused by: feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for request type [java.util.LinkedHashMap]