<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marc Vincent Bentoy</title>
    <description>The latest articles on DEV Community by Marc Vincent Bentoy (@marcbentoy).</description>
    <link>https://dev.to/marcbentoy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F437476%2Fa2b98c6c-4eb3-48db-8359-867a780dc703.jpg</url>
      <title>DEV Community: Marc Vincent Bentoy</title>
      <link>https://dev.to/marcbentoy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marcbentoy"/>
    <language>en</language>
    <item>
      <title>Week 2: Spring Boot Essentials</title>
      <dc:creator>Marc Vincent Bentoy</dc:creator>
      <pubDate>Tue, 22 Apr 2025 07:35:25 +0000</pubDate>
      <link>https://dev.to/marcbentoy/week-2-spring-boot-essentials-4p4i</link>
      <guid>https://dev.to/marcbentoy/week-2-spring-boot-essentials-4p4i</guid>
      <description>&lt;p&gt;In the previous week, we explored the foundational ideas behind the Spring Framework—&lt;strong&gt;IoC&lt;/strong&gt;, &lt;strong&gt;Dependency Injection&lt;/strong&gt;, &lt;strong&gt;Beans&lt;/strong&gt;, and the &lt;strong&gt;ApplicationContext&lt;/strong&gt;. Now, let’s level up and move into the world of &lt;strong&gt;Spring Boot&lt;/strong&gt;, a tool that supercharges the Spring experience with &lt;strong&gt;convention over configuration&lt;/strong&gt;, faster development cycles, and production-ready features out of the box.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Spring Boot?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Spring Boot&lt;/strong&gt; is not a replacement for the Spring Framework but a powerful &lt;strong&gt;extension&lt;/strong&gt; that makes building and deploying Spring applications faster and easier. It removes the need for tedious configuration and lets you focus on writing business logic.&lt;/p&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Spring&lt;/strong&gt; is the foundation.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Spring Boot&lt;/strong&gt; is the builder that lays everything down quickly for you.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Core Concepts We’ll Cover This Week
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Spring Boot Starters&lt;/li&gt;
&lt;li&gt;Auto-configuration&lt;/li&gt;
&lt;li&gt;Devtools&lt;/li&gt;
&lt;li&gt;Spring Initializr&lt;/li&gt;
&lt;li&gt;A simple Hello World app&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Spring Boot Starters
&lt;/h2&gt;

&lt;p&gt;One of the coolest things about Spring Boot is its &lt;strong&gt;starter dependencies&lt;/strong&gt;. Starters are pre-packaged sets of dependencies grouped together for common use cases.&lt;/p&gt;

&lt;p&gt;Here are some common ones:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Starter&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;spring-boot-starter-web&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Build web, RESTful apps using Spring MVC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;spring-boot-starter-data-jpa&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Integrate JPA for database access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;spring-boot-starter-security&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Add security and authentication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;spring-boot-starter-test&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Setup for testing Spring applications&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With one line in your &lt;code&gt;pom.xml&lt;/code&gt; or &lt;code&gt;build.gradle&lt;/code&gt;, you get all the essential libraries and configurations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-web&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Auto-Configuration
&lt;/h2&gt;

&lt;p&gt;One of Spring Boot’s &lt;strong&gt;magic features&lt;/strong&gt; is auto-configuration. Based on the dependencies in your project, Spring Boot will try to automatically configure your application.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you include &lt;code&gt;spring-boot-starter-web&lt;/code&gt;, it configures a web server (Tomcat) for you.&lt;/li&gt;
&lt;li&gt;If it sees an H2 dependency, it sets up an in-memory database automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is enabled by the annotation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@SpringBootApplication&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which is actually a shortcut for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Configuration&lt;/span&gt;
&lt;span class="nd"&gt;@EnableAutoConfiguration&lt;/span&gt;
&lt;span class="nd"&gt;@ComponentScan&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It tells Spring Boot to scan for beans and apply sensible default configurations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Spring Devtools
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Spring Boot Devtools&lt;/strong&gt; is a developer-friendly tool that allows hot reload and better productivity. It automatically restarts your application when you make code changes, so you don’t need to restart the server manually.&lt;/p&gt;

&lt;p&gt;Add this to your &lt;code&gt;pom.xml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-devtools&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;runtime&lt;span class="nt"&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or in Gradle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;developmentOnly&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"org.springframework.boot:spring-boot-devtools"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatic browser refresh&lt;/li&gt;
&lt;li&gt;Disabling cache for static resources (CSS/JS)&lt;/li&gt;
&lt;li&gt;Enhanced logging for debugging&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Spring Initializr: Your Starter Buddy
&lt;/h2&gt;

&lt;p&gt;You don’t need to manually create a project structure—use &lt;a href="https://start.spring.io/" rel="noopener noreferrer"&gt;Spring Initializr&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Just select your dependencies, set your project metadata (group, artifact, Java version), and download a ready-to-run Spring Boot project.&lt;/p&gt;

&lt;p&gt;Example setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Project: Maven&lt;/li&gt;
&lt;li&gt;Language: Java&lt;/li&gt;
&lt;li&gt;Spring Boot: 3.x&lt;/li&gt;
&lt;li&gt;Dependencies: Spring Web, Spring Boot Devtools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Boom—you’re good to go.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let’s Build Your First Spring Boot App
&lt;/h2&gt;

&lt;p&gt;Here’s a basic REST controller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@RestController&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HelloController&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Hello, Spring Boot!"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And your entry point:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@SpringBootApplication&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DemoApplication&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;SpringApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DemoApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./mvnw spring-boot:run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit &lt;code&gt;http://localhost:8080/&lt;/code&gt; and you should see your message.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Spring Boot allows you to go from zero to production-ready in minutes. Once you grasp the &lt;strong&gt;starters&lt;/strong&gt;, &lt;strong&gt;auto-config&lt;/strong&gt;, and use &lt;strong&gt;devtools&lt;/strong&gt; for faster feedback loops, it becomes a joy to build web services.&lt;/p&gt;

&lt;p&gt;But remember: Spring Boot does a lot of things for you under the hood. As we continue this series, we’ll start pulling back the curtain to see exactly what’s going on in that "magic."&lt;/p&gt;




&lt;h3&gt;
  
  
  Up Next: Week 3 - Configuration Management
&lt;/h3&gt;

&lt;p&gt;Next week, we’ll dive into &lt;strong&gt;application properties&lt;/strong&gt;, &lt;strong&gt;YAML&lt;/strong&gt;, &lt;strong&gt;profiles&lt;/strong&gt;, and the &lt;code&gt;@Value&lt;/code&gt; annotation. You’ll learn how to create environment-specific configs and keep secrets out of your code.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Week 1: Spring Core</title>
      <dc:creator>Marc Vincent Bentoy</dc:creator>
      <pubDate>Mon, 07 Apr 2025 07:59:19 +0000</pubDate>
      <link>https://dev.to/marcbentoy/week-1-spring-core-5f07</link>
      <guid>https://dev.to/marcbentoy/week-1-spring-core-5f07</guid>
      <description>&lt;h1&gt;
  
  
  Week 1: Demystifying the Spring Framework – Understanding the Core Concepts
&lt;/h1&gt;

&lt;p&gt;Welcome to the first week of my journey into the Spring ecosystem! This article marks the beginning of my attempt to truly understand how Spring Framework works under the hood, particularly focusing on some of its most foundational concepts: IoC, Dependency Injection, Beans, and the ApplicationContext.&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;
Week 1: Demystifying the Spring Framework – Understanding the Core Concepts

&lt;ul&gt;
&lt;li&gt;🌱 Spring Framework vs. Spring Boot&lt;/li&gt;
&lt;li&gt;🎮 What is Inversion of Control (IoC)?&lt;/li&gt;
&lt;li&gt;
💉 Dependency Injection (DI)

&lt;ul&gt;
&lt;li&gt;Example Constructor Injection:&lt;/li&gt;
&lt;li&gt;Example Setter Injection:&lt;/li&gt;
&lt;li&gt;Example Field Injection:&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;🫘 What are Beans?&lt;/li&gt;

&lt;li&gt;♻️ ApplicationContext: The Spring Container&lt;/li&gt;

&lt;li&gt;💭 Final Thoughts&lt;/li&gt;

&lt;li&gt;⏭️ Up Next: Week 2 - Spring Boot Basics&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;




&lt;p&gt;Before diving in, let’s first clarify a common confusion: Spring Framework vs.&lt;br&gt;
Spring Boot.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🌱 Spring Framework vs. Spring Boot
&lt;/h2&gt;

&lt;p&gt;Many newcomers (like myself) initially get confused between Spring Framework and Spring Boot, since they're often used together. Here's a simple breakdown:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Spring Framework&lt;/th&gt;
&lt;th&gt;Spring Boot&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Purpose&lt;/td&gt;
&lt;td&gt;A comprehensive, modular Java framework for building enterprise apps&lt;/td&gt;
&lt;td&gt;A layer on top of Spring that simplifies setup and configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Configuraiton&lt;/td&gt;
&lt;td&gt;Requires manual setup of beans, XML or Java-based config&lt;/td&gt;
&lt;td&gt;Convention over configuration (sensible defaults, auto-config)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Starter Packs&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Comes withe "starters" for web, JPA, security, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Use Case&lt;/td&gt;
&lt;td&gt;When you need full control over the setup and structure&lt;/td&gt;
&lt;td&gt;When you want to get started quickly with minimal config&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Built On&lt;/td&gt;
&lt;td&gt;Core Spring modules&lt;/td&gt;
&lt;td&gt;Core Spring modules (it's not a replacement!)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So in essence, Spring Boot helps you build apps faster, but it's still powered by Spring Framework underneath.&lt;/p&gt;

&lt;p&gt;Here's an illustration of how the dependency works:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3t3s2um72dcme60si3y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3t3s2um72dcme60si3y.png" alt="High level overview of framework dependency" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🎮 What is Inversion of Control (IoC)?
&lt;/h2&gt;

&lt;p&gt;IoC is the design principle at the heart of Spring. Normally in programming, you control how and when objects are created. But with IoC, you delegate that control to the framework.&lt;/p&gt;

&lt;p&gt;Instead of writing code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Service&lt;/span&gt; &lt;span class="n"&gt;myService&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Service&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Spring handles the object creation and injects it wherever it’s needed. This&lt;br&gt;
inversion of control reduces tight coupling and increases flexibility. Thus, you&lt;br&gt;
simply specify the dependency on your constructor and Spring will supply if for&lt;br&gt;
you.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Controller&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Service&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💉 Dependency Injection (DI)
&lt;/h2&gt;

&lt;p&gt;DI is a specific implementation of IoC where the framework injects the dependencies (i.e., other objects a class needs) automatically.&lt;/p&gt;

&lt;p&gt;There are different types of DI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Constructor Injection (recommended)&lt;/li&gt;
&lt;li&gt;Setter Injection&lt;/li&gt;
&lt;li&gt;Field Injection (less preferred)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Constructor Injection:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Component&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserService&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;UserRepository&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;UserService&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UserRepository&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;userRepository&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, Spring automatically injects a UserRepository instance when creating UserService. However, this is no longer necessary if the target bean has only one constructor, full link &lt;a href="https://docs.spring.io/spring-framework/reference/core/beans/annotation-config/autowired.html#page-title" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Setter Injection:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SimpleMovieLister&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;MovieFinder&lt;/span&gt; &lt;span class="n"&gt;movieFinder&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setMovieFinder&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MovieFinder&lt;/span&gt; &lt;span class="n"&gt;movieFinder&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;movieFinder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;movieFinder&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Field Injection:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MovieRecommender&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;CustomerPreferenceDao&lt;/span&gt; &lt;span class="n"&gt;customerPreferenceDao&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;MovieCatalog&lt;/span&gt; &lt;span class="n"&gt;movieCatalog&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;MovieRecommender&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;CustomerPreferenceDao&lt;/span&gt; &lt;span class="n"&gt;customerPreferenceDao&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;customerPreferenceDao&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;customerPreferenceDao&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🫘 What are Beans?
&lt;/h2&gt;

&lt;p&gt;A Bean is simply an object that is managed by the Spring container. You define a bean by annotating a class with &lt;code&gt;@Component&lt;/code&gt;, &lt;code&gt;@Service&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;@Repository&lt;/code&gt;, or by using &lt;code&gt;@Bean&lt;/code&gt; in a configuration class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Component&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;EmailService&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;sendEmail&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// send email&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This class becomes a Spring-managed bean, meaning Spring takes care of its lifecycle and dependencies.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ♻️ ApplicationContext: The Spring Container
&lt;/h2&gt;

&lt;p&gt;The ApplicationContext is the core interface of the Spring container. It holds all the beans and manages their life cycles.&lt;/p&gt;

&lt;p&gt;Think of it as a registry that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creates and wires beans&lt;/li&gt;
&lt;li&gt;Manages their scopes&lt;/li&gt;
&lt;li&gt;Provides internationalization&lt;/li&gt;
&lt;li&gt;Handles event propagation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you create a Spring Boot app, ApplicationContext is automatically initialized for you. In traditional Spring, you might initialize it manually like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;ApplicationContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AnnotationConfigApplicationContext&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;AppConfig&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;MyService&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getBean&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MyService&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💭 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Understanding IoC, DI, Beans, and the ApplicationContext helps demystify a large part of Spring. These concepts might seem abstract at first, but they are the foundation that powers the rest of the framework—and every feature you’ll use in Spring Boot.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⏭️ Up Next: Week 2 - Spring Boot Basics
&lt;/h2&gt;

&lt;p&gt;Next week, we’ll explore how Spring Boot simplifies setup using auto-configuration, starter dependencies, and devtools.&lt;/p&gt;

&lt;p&gt;If you have any feedback, corrections, or ideas, feel free to share them. See you in the next one!&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>springframework</category>
      <category>spring</category>
    </item>
    <item>
      <title>Demystifying Spring: A Beginner's Journey into Spring Framework and Spring Boot</title>
      <dc:creator>Marc Vincent Bentoy</dc:creator>
      <pubDate>Sun, 06 Apr 2025 17:00:25 +0000</pubDate>
      <link>https://dev.to/marcbentoy/demystifying-spring-a-beginners-journey-into-spring-framework-and-spring-boot-48j8</link>
      <guid>https://dev.to/marcbentoy/demystifying-spring-a-beginners-journey-into-spring-framework-and-spring-boot-48j8</guid>
      <description>&lt;h1&gt;
  
  
  ⛓️ What this series is for?
&lt;/h1&gt;

&lt;p&gt;This series of articles is my personal way of documenting and sharing my understanding of the Spring Framework and Spring Boot. As a beginner with this framework, I believe that uncovering how things work behind the scenes will significantly boost my ability to develop faster, integrate different technologies properly, and write clean, efficient code. If you find any incorrect information or have suggestions, I’d be more than grateful to hear them!&lt;/p&gt;

&lt;h1&gt;
  
  
  🗺️ My journey
&lt;/h1&gt;

&lt;p&gt;My journey into developing web services began with using web frameworks directly—specifically, Ruby on Rails for the backend as a REST API, paired with VueJS for the frontend. At the time, I was a part-time developer while studying at university and had little fundamental knowledge of how the web actually works behind the scenes. This piqued my interest in web technologies and led me to dive deeper into website development, shifting from a Computer Engineering path that typically focuses more on microprocessors and IoT.&lt;/p&gt;

&lt;p&gt;As I continued relying on frameworks and libraries, I gradually started to demystify the wonders of data transmission and HTTP. This opened up a new perspective for me: understanding the fundamentals enables you to apply concepts across different technologies. Much like how grasping the purpose of programming languages makes it easier to pick up new ones, this understanding allowed me to quickly adapt to other web frameworks—such as Go with Fiber, Python with Flask/Django/FastAPI, JavaScript with Express, and most recently, Java with Spring Boot.&lt;/p&gt;

&lt;p&gt;However, I find Java with Spring Boot—and the Spring Framework in general—to be quite unique. While it shares some characteristics with Python web frameworks, like the use of annotations, it has a lot of abstractions that I’m eager to uncover. What I particularly like is the vast ecosystem of libraries that are battle-tested and production-ready. So far, I’ve mostly been using the common annotations for CRUD operations and sticking to the familiar MVC pattern. In reality, my usage of Spring has only scratched the surface.&lt;/p&gt;

&lt;p&gt;That’s why I’m writing this series: to go deeper, understand the “why” behind the magic, and hopefully help others along the way.&lt;/p&gt;

&lt;h1&gt;
  
  
  🗓️ Weekly Plan
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Week&lt;/th&gt;
&lt;th&gt;Focus Area&lt;/th&gt;
&lt;th&gt;Key Topics&lt;/th&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Fundamentals&lt;/td&gt;
&lt;td&gt;IoC, DI, Beans, ApplicationContext&lt;/td&gt;
&lt;td&gt;Understand core Spring concepts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Spring Boot Basics&lt;/td&gt;
&lt;td&gt;Spring Boot auto-configuration, starters, devtools&lt;/td&gt;
&lt;td&gt;Build your first Spring Boot app&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Configuration&lt;/td&gt;
&lt;td&gt;Properties, Profiles, YAML, @Value&lt;/td&gt;
&lt;td&gt;Manage environment configs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Data Layer&lt;/td&gt;
&lt;td&gt;Spring JDBC Template, Spring Data JPA, Repositories, Entity Relationships&lt;/td&gt;
&lt;td&gt;CRUD with databases&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Web Layer&lt;/td&gt;
&lt;td&gt;Spring MVC, REST Controllers, Request Mapping&lt;/td&gt;
&lt;td&gt;Create RESTful services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Advanced Topics&lt;/td&gt;
&lt;td&gt;AOP, Transactions, Error Handling&lt;/td&gt;
&lt;td&gt;Write robust, scalable code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Spring Security&lt;/td&gt;
&lt;td&gt;Auth, JWT, Method-level security&lt;/td&gt;
&lt;td&gt;Secure your apps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Final Project&lt;/td&gt;
&lt;td&gt;REST API project&lt;/td&gt;
&lt;td&gt;Consolidate everything&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  💭 Final Thoughts
&lt;/h1&gt;

&lt;p&gt;I hope you find this series insightful and helpful in your own Spring learning journey. Cheers! ☕&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>springframework</category>
      <category>spring</category>
    </item>
  </channel>
</rss>
