How to do it...

  1. We will start by adding Netflix Feign module dependencies to our project. Let's modify our build.gradle file located in the root of our project with the following content:
dependencies { 
    ... 
    compile("org.springframework.cloud:spring-    cloud-starter-consul-all") 
    compile("org.springframework.cloud:spring-    cloud-starter-openfeign") 
    runtime("com.h2database:h2") 
    ... 
} 
  1. With the dependency added, our next step is to create a Java API interface describing how we want to define our interaction with the BookPub service. Let's create an api package under the src/main/java/com/example/bookpub directory from the root of our project.
  2. Inside the newly-created api package, let's create our API class file named BookPubClient.java with the ...

Get Developing Java Applications with Spring and Spring Boot now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.