Tech with Maddy | Tech and Writing

Spring Boot Architecture

Spring Boot Architecture

This article will explain how the Spring Boot architecture operates.

Let's start.

What Is Spring Boot?

Spring Boot is built on top of the Spring Framework. It's a more automated and simplified version of Spring.

Spring Boot reduces manual configuration, and through Maven (or Gradle), it makes it easier to resolve dependency conflicts. In addition, Spring Boot has a built-in HTTP server that helps engineers start the application quickly.

Spring Boot makes it easy to create an up-and-running application in a few minutes. You can go to Spring Initializr:

springInitializr.png

And the website will generate the application for you in an instant.

If you're undecided on whether to learn Spring or Spring Boot, I'd say to at least know the basics of the Spring Framework and then jump onto Spring Boot.

What Is the Difference Between Spring and Spring Boot?

If you've ever tried to write a Java application a time ago, you would have noticed how much work you had to do to perform database operations. It's a tiring process!

The Spring Framework simplifies these operations, thanks to the Spring JDBC module.

Spring is the combination of multiple sub-frameworks. It has many modules, for example, Spring MVC, Spring JDBC, Spring AOP, Spring ORM, and Spring Test. The core feature of the Spring Framework is Dependency Injection.

Even though Spring has made the development of Java applications easier, I think it is vast and complicated to master.

In the past, I tried to learn the Spring Framework from scratch, and I found it a long experience. This is where Spring Boot comes in handy, though. 馃榿

Now, let's talk about Spring Boot Architecture.

Spring Boot Architecture

Spring Boot Architecture has four layers:

  • Presentation Layer

  • Business Layer

  • Persistence Layer

  • Database Layer

Spring Boot Architecture.png

Presentation Layer

This layer is at the top of the architecture. This tier is responsible for:

  • Performing authentication.

  • Converting JSON data into an object (and vice versa).

  • Handling HTTP requests.

  • Transferring authentication to the business layer.

The presentation layer is the equivalent of the Controller class. The Controller class handles all the incoming REST API requests (GET, POST, PUT, DELETE, PATCH) from the Client.

Business Layer

The business layer is responsible for:

  • Performing validation.

  • Performing authorization.

  • Handling the business logic and rules.

This layer is the equivalent of the Service class. It's where you handle the business logic.

The business logic in software engineering is where you decide what the software needs to do. An example of this is validation. If you are ever requested to validate something, this needs to happen inside the Service class.

The Business layer communicates with both the Presentation layer and the Persistence Layer.

Persistence Layer

This layer is responsible for the following:

  • Containing storage logic.

  • Fetching objects and translating them into database rows (and vice versa).

This layer is the equivalent of the Repository interface. You write database queries inside this interface.

The Persistence layer is the only layer communicating with the Business and Database layers.

Database Layer

This layer is responsible for performing database operations (mainly CRUD operations).

This layer is simply the actual database that you decide to use to build your application.

Spring Boot Workflow

Spring Boot workflow.png

Spring Boot workflow acts like this:

  1. The Client makes an HTTP request.

  2. The Controller class receives the HTTP request.

  3. The Controller understands what type of request will be processed, and then it deals with it.

  4. If it is needed, it calls the service class.

  5. The Service Class is going to handle the business logic. It does this on the data from the database.

  6. If everything goes well, you return a JSP page.

Key Takeaways

After reading this article, you'll learn about Spring Boot architecture and how it works.

Now learn how to create a Spring Boot Rest API.

Until next time! 馃憢馃従

ADDITIONAL RESOURCES

  • Spring Boot Documentation

  • Baeldung: A Comparison between Spring and Spring Boot

  • IBM: Java Spring Boot

4617作文网酒店企业名字起破解梦幻李韦起名算命八字占卜周易生辰八字时辰周公解梦梦见大熊周杰伦的歌为什么在网易云下架了贷款公司怎么起名字在线八字免费算命起名字工具 免费周易测字算吉凶周易测名打分测试邵伟华周易根据爸妈名字起名文化教育有限公司起名周易万物数姓陈字取名起名大全大全易经取名起名大全软件怎么样给女孩子起名字排八字起名字的周易免费看相生辰八字测财运周易知识讲座五行缺火 起姓名大全梦幻家园破解版在哪里下载起名米周公解梦是哪个周公周易测名三藏公司起名带畅字找到起名字起英文姓名的网站淀粉肠小王子日销售额涨超10倍罗斯否认插足凯特王妃婚姻让美丽中国“从细节出发”清明节放假3天调休1天男子给前妻转账 现任妻子起诉要回网友建议重庆地铁不准乘客携带菜筐月嫂回应掌掴婴儿是在赶虫子重庆警方辟谣“男子杀人焚尸”国产伟哥去年销售近13亿新的一天从800个哈欠开始男孩疑遭霸凌 家长讨说法被踢出群高中生被打伤下体休学 邯郸通报男子持台球杆殴打2名女店员被抓19岁小伙救下5人后溺亡 多方发声单亲妈妈陷入热恋 14岁儿子报警两大学生合买彩票中奖一人不认账德国打算提及普京时仅用姓名山西省委原副书记商黎光被逮捕武汉大学樱花即将进入盛花期今日春分张家界的山上“长”满了韩国人?特朗普谈“凯特王妃P图照”王树国3次鞠躬告别西交大师生白宫:哈马斯三号人物被杀代拍被何赛飞拿着魔杖追着打315晚会后胖东来又人满为患了房客欠租失踪 房东直发愁倪萍分享减重40斤方法“重生之我在北大当嫡校长”槽头肉企业被曝光前生意红火手机成瘾是影响睡眠质量重要因素考生莫言也上北大硕士复试名单了妈妈回应孩子在校撞护栏坠楼网友洛杉矶偶遇贾玲呼北高速交通事故已致14人死亡西双版纳热带植物园回应蜉蝣大爆发男孩8年未见母亲被告知被遗忘张立群任西安交通大学校长恒大被罚41.75亿到底怎么缴沈阳一轿车冲入人行道致3死2伤奥运男篮美国塞尔维亚同组周杰伦一审败诉网易国标起草人:淀粉肠是低配版火腿肠外国人感慨凌晨的中国很安全男子被流浪猫绊倒 投喂者赔24万杨倩无缘巴黎奥运男子被猫抓伤后确诊“猫抓病”春分“立蛋”成功率更高?记者:伊万改变了国足氛围奥巴马现身唐宁街 黑色着装引猜测

4617作文网 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化