官术网_书友最值得收藏!

Creating Java Microservices

We've seen a lot of theory behind microservice architecture in Chapter 3, Working with Microservices. It's time to do some hands-on practice; we are going to implement our own microservice. This will be a simple REST service, accepting HTTP methods such as GET and POST to retrieve and update entities. There are a couple of choices when developing microservices in Java. In this chapter, we are going to get an overview about two main approaches, probably the most popular will be JEE7, and Spring Boot. We will briefly see how we can code a microservice using JEE JAX-RS. We will also create a microservice running on Spring Boot. In fact, in Chapter 5, Creating Images with Java Applications, we are going to run our Spring Boot microservice from within a Docker container. As we have said in Chapter 3, Working with Microservices, microservices usually communicate with the outside world using REST. Our REST microservice will be as simple as possible; we just need to have something to deploy using Docker and Kubernetes. We will not focus on advanced microservice features such as authentication, security, filters, and so on, as this is outside the scope of this book. The purpose of our examples is to give you an idea of how to develop REST services and then deploy them using Docker and Kubernetes. This chapter will cover the following topics:

  • Introduction to REST
  • Creating a REST service in Java using Java EE7 annotations
  • Creating a REST service using Spring Boot
  • Running the service and then calling it with different HTTP clients

At the end of the chapter, we will become familiar with some useful tools- we will use some code generation tools such as Spring Initialzr to quickly bootstrap a Spring Boot service project. Before we start coding our own microservice, let's explain briefly what REST is.

主站蜘蛛池模板: 大埔区| 宁河县| 安化县| 枣庄市| 九龙坡区| 通化县| 永康市| 梅州市| 牟定县| 仁怀市| 丹凤县| 西青区| 牡丹江市| 建宁县| 三明市| 锡林郭勒盟| 咸丰县| 鱼台县| 蓝山县| 黎川县| 庆元县| 澜沧| 民乐县| 桂阳县| 龙胜| 德格县| 缙云县| 温泉县| 遂溪县| 防城港市| 明溪县| 曲水县| 鱼台县| 乌兰县| 吉水县| 汉源县| 鄂伦春自治旗| 海晏县| 闽清县| 宁陵县| 巴青县|