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

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.

主站蜘蛛池模板: 汝州市| 伊吾县| 衡东县| 合川市| 星子县| 筠连县| 腾冲县| 日喀则市| 六安市| 洞头县| 赤城县| 安岳县| 惠来县| 阿拉善右旗| 昭觉县| 宜阳县| 禄丰县| 五常市| 京山县| 当涂县| 萨迦县| 彰武县| 忻州市| 鸡西市| 禹城市| 隆昌县| 宁阳县| 天门市| 尉氏县| 伊川县| 宝应县| 五峰| 新源县| 长寿区| 清苑县| 灵石县| 台南县| 龙陵县| 五台县| 屏边| 江津市|