Book Image

Spring 5.0 Cookbook

By : Sherwin John C. Tragura
Book Image

Spring 5.0 Cookbook

By: Sherwin John C. Tragura

Overview of this book

The Spring framework has been the go-to framework for Java developers for quite some time. It enhances modularity, provides more readable code, and enables the developer to focus on developing the application while the underlying framework takes care of transaction APIs, remote APIs, JMX APIs, and JMS APIs. The upcoming version of the Spring Framework has a lot to offer, above and beyond the platform upgrade to Java 9, and this book will show you all you need to know to overcome common to advanced problems you might face. Each recipe will showcase some old and new issues and solutions, right from configuring Spring 5.0 container to testing its components. Most importantly, the book will highlight concurrent processes, asynchronous MVC and reactive programming using Reactor Core APIs. Aside from the core components, this book will also include integration of third-party technologies that are mostly needed in building enterprise applications. By the end of the book, the reader will not only be well versed with the essential concepts of Spring, but will also have mastered its latest features in a solution-oriented manner.
Table of Contents (20 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Consuming endpoints using a declarative method


Another way of writing client applications for microservices is through the use of Spring Cloud Netflix Feign which utilizes a declarative and easy mechanism of writing clients for RESTful endpoints.

Getting started

Create a new Spring Boot application that is an independent specimen on how to enable Feign as the client solution in a client Spring Boot application that aims to consume exposed web services from typical or Eureka-registered microservices.

How to do it...

Apply the Feign client solution to Spring Boot application by the following steps:

  1. Create a Maven project ch10-feign that contains core starter POM such as webflux, actuator, and Tomcat server for Spring Boot 2.0 with the addition of the needed Spring Cloud dependent management configuration which is Spring Cloud Finchley.
  2. Add the following Spring Cloud Netflix Feign dependency in the pom.xml.
<dependency> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId...