Understanding Spring Beans in 7 Days

🚀 Day 7 — What is Bean? (Core Spring Concept 🔥) Today I understood one important thing… 👉 Everything in Spring is a Bean 💡 What is a Bean? 👉 A Bean is an object created and managed by Spring (IoC container) (Simple: Spring creates object, we just use it) ⚙️ How Spring Creates Bean? Using XML (<bean>) Using Annotations (@Component, @Service) 👉 Spring container creates, manages, and injects beans ⚡ Bean Scope (Important 🔥) 🔹 Singleton (default) 👉 Only ONE object created 🔹 Prototype 👉 New object every time 🔍 Bean Lifecycle (Simple Flow) 👉 Create → Initialize → Use → Destroy 💡 One line I learned: 👉 In Spring, objects are called Beans and Spring manages them 💬 Which scope confused you — Singleton or Prototype? Day 7 done ✅ #Spring #Java #BackendDevelopment #LearningInPublic #30DaysOfCode #SpringBoot #Developers

  • text, application, chat or text message

Good breakdown—understanding beans is the foundation for everything in Spring. The tricky part is how scope behaves in real scenarios, especially injecting a prototype bean into a singleton where it doesn’t behave as expected. Have you explored how Spring handles that with providers or ObjectFactory?

To view or add a comment, sign in

Explore content categories