Back to blog Backend Interview

50 Spring Core Real Interview Questions Asked in MNC

22 min readBackend Interview

Basics of Spring

1. What is the Spring Framework and why is it used?

2. What are the key features of the Spring Framework?

3. Explain Inversion of Control (IoC).

4. What is Dependency Injection (DI)?

5. What are the types of dependency injection supported by Spring?

6. What is a Spring Bean?

7. How do you define a bean in Spring using XML?

8. How do you define a bean using annotations?

9. What are stereotype annotations (@Component, @Service, @Repository)?

10. Differences between @Component and @Bean.

Spring Container & Bean Lifecycle

1. What is the Spring IoC container?

2. Difference between BeanFactory and ApplicationContext.

3. How does Spring perform bean lifecycle management?

4. What is bean scope? Explain scopes in Spring.

5. What is bean post processor?

6. How does Spring handle circular dependencies?

7. What are lazy initialized beans?

8. What is singleton vs prototype bean?

Configuration

1. What are the ways to configure Spring (XML vs JavaConfig)?

2. What is @Configuration?

3. What is @ComponentScan used for?

4. How do property files work in Spring?

5. What are profiles in Spring?

Autowiring & Qualifiers

1. What is autowiring in Spring?

2. Types of autowiring supported by Spring.

3. What is @Qualifier used for?

4. What is @Primary?

Advanced Core Concepts

1. What is Aspect-Oriented Programming (AOP) in Spring?

2. What are advices, pointcuts, and aspects?

3. How does Spring implement AOP (proxy based)?

4. What is JoinPoint vs Pointcut?

5. Explain Spring Expression Language (SpEL).

6. What is @Aspect annotation?

7. Can Spring AOP intercept private methods?

8. Is Spring AOP compile-time or runtime?

Context & Dependency

1. What is ApplicationContext and its types?

2. How do you load Spring context programmatically?

3. How does Spring manage dependencies at runtime?

Exception & Error Handling

1. What exceptions are common in Spring DI?

2. How do you fix “NoSuchBeanDefinitionException”?

3. How to solve “NoUniqueBeanDefinitionException”?

Bean Lifecycle Customization

1. How to use @PostConstruct and @PreDestroy?

2. What is BeanDefinition and BeanDefinitionRegistry?

Practical + Coding

1. How to inject collections (List/Set/Map) into a Spring bean?

2. How do you externalize configuration?

3. How to register listeners in Spring context?

Testing & Integration

1. How do you unit test Spring beans?

2. What is Spring TestContext Framework?

3. How to mock Spring beans using Mockito?

4. How to load only specific configuration classes in tests?

InterviewExpert.org

Writing about interviews, stacks, and getting hired.

Leave a comment