← Back to list

My Early Confusion While Learning Spring Boot

When you start learning Spring Boot, the first problem is not writing code. The real problem is understanding where to start.

Mohammad Hasibul Hasan · 2026-01-04 18:35 · 21 claps · 1.9 min read
#spring-boot #java #programming #developer #how-to-learn
Open on Medium ↗
Wiki topics: EDU · Education & Learning 💻 · Programming

My Early Confusion While Learning Spring Boot

When you start learning Spring Boot, the first problem is not writing code. The real problem is understanding where to start.

At the beginning, everything feels confusing.

You hear words like Controller, Service, Repository, Entity, DTO, Mapper but no one clearly explains how they all connect together.

Questions keep coming into your mind:

  • Where should I start?
  • How does Spring Boot actually work?
  • What is the Repository layer?
  • Why does only the Repository talk to the database?
  • Why doesn’t the Controller know anything about the database?

If you are thinking like this, you are not alone. Every Spring Boot learner goes through this phase.

Spring Boot Simple Architecture

Spring Boot Simple Architecture

Understanding the Layers Changes Everything

Spring Boot follows a layered structure, and once you understand the responsibility of each layer, things become much clearer.

Controller layer This is where requests come in. The Controller receives requests from Postman or the frontend and sends responses back. Its job is simple: take input and return output. It should not contain business logic, and it should not know how the database works.

Service layer This is where the real logic lives. The Service decides what to do with the data, applies rules, and calls the Repository when database access is needed.

Repository layer This layer talks directly to the database. That’s why only the Repository knows about database operations. Keeping database logic here helps the application stay clean and maintainable.

Why Entity, DTO, and Mapper Exist

Another confusing part is understanding Entity, DTO, and Mapper.

  • Entity represents database tables
  • DTO represents data that goes in and out of your API
  • Mapper converts Entity to DTO and DTO to Entity

The Mapper works like a bridge between layers so that internal database structure is not exposed directly.

Who Calls Whom?

The flow is always one-directional:

Controller → Service → Repository → Database

Not the other way around. Once this flow becomes clear, Spring Boot starts to make sense.

Another Challenge: Where Do I Start Writing Code?

Even after understanding the layers, another question appears:

Should I start with Controller or Entity? Where do I write Mapper? Which file should come first?

A simple and practical approach is:

  1. Start with Entity
  2. Create Repository
  3. Add DTO and Mapper
  4. Write Service
  5. Finally, create Controller

Starting with the Entity helps you understand what data you are working with.

Final Thoughts

Spring Boot feels difficult at the beginning because you are learning architecture, not just code.

Once you understand:

  • the role of each layer,
  • how data flows,
  • and why separation exists,

everything starts to feel logical.

So if you’re confused right now, don’t quit. That confusion means you’re learning Spring Boot the right way.


메타데이터
post_id
bcd259ffd32e
slug
my-early-confusion-while-learning-spring-boot-bcd259ffd32e
url
https://medium.com/@hasibulhimu49/my-early-confusion-while-learning-spring-boot-bcd259ffd32e
canonical_url
https://medium.com/@hasibulhimu49/my-early-confusion-while-learning-spring-boot-bcd259ffd32e
author_url
https://medium.com/@hasibulhimu49
status
ok
fetched_at
2026-07-26 13:28:39