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

  • Spring 5.0 By Example
  • Claudio Eduardo de Oliveira
  • 348字
  • 2021-06-24 19:17:27

Microservices and Spring Boot

The microservices architectural style, in general, is distributed, must be loosely coupled, and be well-defined. These characteristics must be followed when you want a microservices architecture.

Much of Spring Boot is aimed at developer productivity by making common concepts, such as RESTful HTTP and embedded web application runtimes, easy to wire up and use. In many respects, it also aims to serve as a micro-framework, by enabling developers to pick and choose the parts of the framework they need, without being overwhelmed by bulky or otherwise unnecessary runtime dependencies. This also enables Boot applications to be packaged into small units of deployment, and the framework is able to use build systems to generate those deployables as runnable Java archives.

The main characteristics of microservices are:

  • Small-grained components
  • Domain responsibility (orders, shopping carts)
  • Programming-language agnostic
  • Database agnostic

Spring Boot enables us to run an application on embedded web servers such as Tomcat, Jetty, and Undertow. This makes it extremely easy to deploy our components because it is possible to expose our HTTP APIs in one JAR.

The Spring Team even thinks in terms of developer productivity, and they offer a couple of projects called starters. These projects are groups of dependencies with some compatibilities. These awesome projects additionally work with the convention over configuration. Basically, they are common configurations that developers need to make on every single project. We can change these settings in our application.properties or application.yaml files.

Another critical point for microservices architecture is monitoring. Let's say that we're working on an e-commerce solution. We have two components, shopping cart and payments. The shopping cart probably needs to have several instances and payments need to have fewer instances. How can we check these several instances? How can we check the health of these services? We need to fire an alarm when these instances go down. This is a common implementation for all services. The Spring Framework supplies a module called Spring Boot Actuator that provides some built-in health checks for our application, databases, and much more.

主站蜘蛛池模板: 丹寨县| 田林县| 龙游县| 新和县| 冕宁县| 荣昌县| 芦溪县| 潜山县| 大城县| 丰原市| 丹江口市| 滁州市| 德昌县| 开原市| 冕宁县| 绥芬河市| 商河县| 正阳县| 边坝县| 舞钢市| 米泉市| 永修县| 枣庄市| 阳山县| 科尔| 林口县| 郴州市| 华容县| 桃江县| 鹿邑县| 思茅市| 基隆市| 清新县| 罗定市| 常山县| 瓦房店市| 游戏| 武邑县| 孟村| 阳东县| 新安县|