Spring Boot Interview Question

What is a Spring bean?

Updated 2026-07-10 · Beginner friendly
Quick answer

A Spring bean is an object that the Spring container creates, configures, and manages for you. You mark a class as a bean with annotations like Component, Service, or Bean, and Spring keeps it in its application context ready to inject where needed. By default beans are singletons, meaning one shared instance per container.

How a bean is created

@Component
class EmailService { }

// or from a configuration method
@Bean
EmailService emailService() { return new EmailService(); }

Common bean scopes

In the interview

Be ready for the scope question. Say the default is singleton, one shared instance, and use prototype when you need a fresh object each time. Knowing that singleton is the default catches a common misconception.

Want the full Spring Boot guide?

Read every Spring Boot concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the Spring Boot guide All Spring Boot questions