diff --git a/content/courses/spring-boot/_index.md b/content/courses/spring-boot/_index.md
index 8a98741..584a3a5 100644
--- a/content/courses/spring-boot/_index.md
+++ b/content/courses/spring-boot/_index.md
@@ -5,61 +5,60 @@ weight: 3
# Prerequisites
-* Solid understanding of Java
-* Object-oriented programming
-* Classes, methods and interfaces
-* Basic understanding of databases
-* Tables, primary keys, foreign keys, relationships, etc.
-* Write basic SQL statements
+Before diving in, make sure you're comfortable with the following:
----
+- **Java** — solid understanding of the language
+- **Object-oriented programming** — classes, methods and interfaces
+- **Databases** — tables, primary keys, foreign keys, relationships, etc.
+- **SQL** — ability to write basic SQL statements
+
+---
# What is a Spring Framework?
-**Spring** -- is a popular framework for building Java applications. It has a lot of modules, each designed to handle a specific task. They are combined into few different layers.
+**Spring** is a popular framework for building Java applications. It has a lot of modules, each designed to handle a specific task. They are combined into a few different layers.
-
-*Img. 1 -- Spring layers*
+
+*Img. 1 — Spring layers*
| **Layer** | **Purpose** |
-| ------------- | -------------- |
-| *Core* | Handling dependency injection, managing objects |
-| *Web* | Building web applications |
-| *Data* | Working with databases |
-| *AOP* | Aspect oriented programming |
-| *Test* | Testing spring components |
+|-----------|-------------|
+| *Core* | Handling dependency injection, managing objects |
+| *Web* | Building web applications |
+| *Data* | Working with databases |
+| *AOP* | Aspect oriented programming |
+| *Test* | Testing spring components |
----
+---
-While the spring framework is powerfull, using it often involves a lot of configuration. For example, if you want to build a web app you might need to setup a web server, configure routing and manage dependencies manually. That's when **Spring Boot** comes in.
+While the Spring Framework is powerful, using it often involves a lot of configuration. For example, if you want to build a web app you might need to setup a web server, configure routing and manage dependencies manually. That's when **Spring Boot** comes in.
-You can think of spring boot as a layer on top of the spring framework, that takes care of all of the setup.
+> [!NOTE]
+> You can think of Spring Boot as a layer on top of the Spring Framework that takes care of all of the setup. *Spring Boot* simplifies Spring development by providing sensible defaults and ready-to-use features.
-*Sring Boot* siplifies Spring development by providing sensible defaults and ready-to-use features.
+By the way, the Spring Framework is just one part of a larger family of projects in the **Spring ecosystem**.
-By the way, the spring framework is just one part of a larger family of projects in the spring ecosystem.
+
+*Img. 2 — Spring ecosystem*
-
-*Img. 2 -- Spring ecosystem*
+| **Module Name** | **Purpose** |
+|------------------------|-------------|
+| *Spring Data* | Simplifying database access |
+| *Spring Security* | Adding authentication and authorization |
+| *Spring Batch* | Batch processing |
+| *Spring Cloud* | Building microservices and distributed systems |
+| *Spring Integration* | Simplifying messaging and integration between systems |
-| **Module Name** | **Purpose** |
-| ------------- | -------------- |
-| *Spring Data* | Simplifying database access |
-| *Spring Security* | Adding authentication and authorization |
-| *Spring Batch* | Batch processing |
-| *Spring Cloud* | Building microservices and distributed systems |
-| *Spring Integration* | Symplifying messaging and integration between systems |
+---
----
+# Initialize Spring Boot Project
-# Initialize Spring Boot Project
-
-To initialize a new spring boot project you can go to [start.spring.io](https://start.spring.io/) and select options that suits you.
+To initialize a new Spring Boot project, go to [start.spring.io](https://start.spring.io/) and select the options that suit you.

-*Img. 3 -- Spring Boot options*
+*Img. 3 — Spring Boot options*
-After unpacking the `zip` arvhive we have this template project.
+After unpacking the `zip` archive, you'll have this template project:
```bash
.
@@ -70,23 +69,23 @@ After unpacking the `zip` arvhive we have this template project.
├── src
│ ├── main
│ │ ├── java
-│ │ │ └── us
-│ │ │ └── fymio
+│ │ │ └── tech
+│ │ │ └── codejava
│ │ │ └── store
│ │ │ └── StoreApplication.java
│ │ └── resources
│ │ └── application.properties
│ └── test
│ └── java
-│ └── us
-│ └── fymio
+│ └── tech
+│ └── codejava
│ └── store
│ └── StoreApplicationTests.java
└── target
├── classes
│ ├── application.properties
- │ └── us
- │ └── fymio
+ │ └── tech
+ │ └── codejava
│ └── store
│ └── StoreApplication.class
├── generated-sources
@@ -104,16 +103,16 @@ After unpacking the `zip` arvhive we have this template project.
│ ├── createdFiles.lst
│ └── inputFiles.lst
├── surefire-reports
- │ ├── TEST-us.fymio.store.StoreApplicationTests.xml
- │ └── us.fymio.store.StoreApplicationTests.txt
+ │ ├── TEST-tech.codejava.store.StoreApplicationTests.xml
+ │ └── tech.codejava.store.StoreApplicationTests.txt
└── test-classes
- └── us
- └── fymio
+ └── tech
+ └── codejava
└── store
└── StoreApplicationTests.class
```
-The "heart" of our project is the file named `pom.xml`:
+The "heart" of our project is `pom.xml`:
```xml
@@ -122,85 +121,85 @@ The "heart" of our project is the file named `pom.xml`:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 4.0.2
-
-
- us.fymio
- store
- 0.0.1-SNAPSHOT
- store
- Store
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 21
-
-
-
- org.springframework.boot
- spring-boot-starter
-
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 4.0.2
+
+
+ tech.codejava
+ store
+ 0.0.1-SNAPSHOT
+ store
+ Store
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 21
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
```
Maven uses this file to download dependencies and build our project.
-In the `source` folder we have the actual code for our project.
+In the `src` folder we have the actual code:
```bash
src
├── main
│ ├── java
-│ │ └── us
-│ │ └── fymio
+│ │ └── tech
+│ │ └── codejava
│ │ └── store
│ │ └── StoreApplication.java
│ └── resources
│ └── application.properties
└── test
└── java
- └── us
- └── fymio
+ └── tech
+ └── codejava
└── store
└── StoreApplicationTests.java
```
-The `StoreApplication.java` file is the entry point to our application.
+`StoreApplication.java` is the entry point to our application:
```java
-package us.fymio.store;
+package tech.codejava.store;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -208,20 +207,20 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StoreApplication {
- public static void main(String[] args) {
- SpringApplication.run(StoreApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(StoreApplication.class, args);
+ }
}
```
-In the `main` method we have a call to `SpringApplication.run` method.
+In the `main` method we have a call to `SpringApplication.run`.
-If we run `mvn clean install` from the root of our project we will get this result (the output is partially reduced):
+Running `mvn clean install` from the root of our project gives us this result *(output partially reduced)*:
```bash
...
-[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.542 s -- in us.fymio.store.StoreApplicationTests
+[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.542 s -- in tech.codejava.store.StoreApplicationTests
[INFO]
[INFO] Results:
[INFO]
@@ -233,10 +232,6 @@ If we run `mvn clean install` from the root of our project we will get this resu
[INFO]
[INFO] --- spring-boot:4.0.2:repackage (repackage) @ store ---
...
-...
-[INFO] Installing /home/fymio/store/pom.xml to /home/fymio/.m2/repository/us/fymio/store/0.0.1-SNAPSHOT/store-0.0.1-SNAPSHOT.pom
-[INFO] Installing /home/fymio/store/target/store-0.0.1-SNAPSHOT.jar to /home/fymio/.m2/repository/us/fymio/store/0.0.1-SNAPSHOT/store-0.0.1-SNAPSHOT.jar
-[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.787 s
@@ -244,18 +239,20 @@ If we run `mvn clean install` from the root of our project we will get this resu
[INFO] ------------------------------------------------------------------------
```
-So we can tell that our application was built without errors.
+Our application built without errors.
+
+---
# Dependency Management
-Dependencies are third-party libraries or frameworks we use in our application. For example to build a web application we need an embedded web server like *Tomcat*, we need libraries for handling web requests building APIs, processing JSON data, logging and so on.
+Dependencies are third-party libraries or frameworks we use in our application. For example, to build a web application we need an embedded web server like *Tomcat*, libraries for handling web requests, building APIs, processing JSON data, logging and so on.
-In spring boot applications instead of adding multiple individual libraries we can use a **starter dependency**.
+In Spring Boot applications, instead of adding multiple individual libraries, we can use a **starter dependency**.
-
-*Img. 5 -- Spring Boot Starter Web*
+
+*Img. 5 — Spring Boot Starter Web*
-To use this dependency we just need to copy the code below to our `pom.xml` file.
+To use this dependency, copy the following into your `pom.xml`:
```xml
@@ -265,53 +262,54 @@ To use this dependency we just need to copy the code below to our `pom.xml` file
```
-So the `dependencies` section would look like this
+So the `dependencies` section would look like this:
```xml
-
- org.springframework.boot
- spring-boot-starter
-
+
+ org.springframework.boot
+ spring-boot-starter
+
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
```
-Notice, that I commented out the version of our dependency. That's because it's a better practice to let Spring Boot decide what version of the dependency to use.
+> [!IMPORTANT]
+> Notice that the version is commented out. It's a better practice to let Spring Boot decide what version of the dependency to use, as it ensures compatibility across your project.
+
+---
# Controllers
-**Spring MVC** stands for *Model View Controller*.
+**Spring MVC** stands for *Model View Controller*.
-*Model* is where our application's data lives. It represents the business logic and is usually connected to a database or other data sources. In spring boot the model can be a simple java class.
+- **Model** is where our application's data lives. It represents the business logic and is usually connected to a database or other data sources. In Spring Boot, the model can be a simple Java class.
+- **View** is what the user sees. It's the HTML, CSS or JavaScript rendered in the browser. In Spring MVC, views can be static files or dynamically generated.
+- **Controller** is like a traffic controller. It handles incoming requests from the user, interacts with the model to get data and then tells the view what to display.
-*View* is what the user sees. It's the HTML, CSS or JavaScript that's rendered in the browser. In Spring MVC views can be static files or dynamically generated.
-
-*Controller* is like a traffic controller. It handles incoming requests from the user, interacts with the model to get data and then tells the view what to display.
-
-Let's add a new java class called `HomeController`. It will be located at `src/main/java/us/fymio/store/HomeController.java`.
+Let's add a new Java class called `HomeController` at `src/main/java/tech/codejava/store/HomeController.java`:
```java
-package us.fymio.store;
+package tech.codejava.store;
public class HomeController {}
```
-To make this a controller we have to decorate it with the controller annotation. And import the `Controller` from `org.springframework.stereotype` package.
+To make this a controller, decorate it with the `@Controller` annotation:
```java
-package us.fymio.store;
+package tech.codejava.store;
import org.springframework.stereotype.Controller;
@@ -319,10 +317,10 @@ import org.springframework.stereotype.Controller;
public class HomeController {}
```
-Let's now add an `index` method. When we send a request to the root of our website we want this method to be called. Also we need to add another special annotation to this method.
+Now let's add an `index` method. When we send a request to the root of our website, we want this method to be called:
```java
-package us.fymio.store;
+package tech.codejava.store;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -337,7 +335,7 @@ public class HomeController {
}
```
-Now we need to create this view. We add the `index.html` at `src/main/resources/static/index.html`. For now let's just print "Hello world!".
+Now we need to create the view. Add `index.html` at `src/main/resources/static/index.html`:
```html
@@ -353,33 +351,31 @@ Now we need to create this view. We add the `index.html` at `src/main/resources/