Top 200+ Most Asked Spring Boot Interview Questions

Comprehensive Spring Boot guide covering Introduction, Architecture, Configuration, and IoC/DI. Each answer is technically rigorous for professional interviews.

0%

Overall Progress

0/225

1.What is Spring Boot? Why use it?

2.What are the advantages of Spring Boot over Spring Framework?

3.What is auto-configuration in Spring Boot?

4.How does auto-configuration work internally?

5.What is @SpringBootApplication annotation? What does it combine?

6.What are Spring Boot Starters? List important ones

7.What is the difference between Spring, Spring MVC, and Spring Boot?

8.What is convention over configuration?

9.What is embedded server? Which servers are supported?

10.How do you create a Spring Boot application?

11.Explain Spring Boot Architecture (Layered Architecture)

12.What is application.properties vs application.yml?

13.What is the property loading order/hierarchy in Spring Boot?

14.How do you externalize configuration?

15.What is @Value annotation?

16.What is @ConfigurationProperties?

17.What is the difference between @Value and @ConfigurationProperties?

18.What are Spring profiles?

19.How do you activate profiles?

20.What is @Profile annotation?

21.What is @PropertySource annotation?

22.How do you use environment-specific properties files?

23.What is application-dev.properties vs application-prod.properties?

24.How do you override properties from command line?

25.What is Spring Boot DevTools? What features does it provide?

26.What is IoC (Inversion of Control)?

27.What is Dependency Injection?

28.What are the types of Dependency Injection?

29.What is Constructor Injection vs Setter Injection vs Field Injection?

30.Which injection type is recommended and why?

31.What is @Autowired annotation?

32.What is @Component annotation?

33.What is the difference between @Component, @Service, @Repository, and @Controller?

34.What is @Bean annotation?

35.What is the difference between @Component and @Bean?

36.What is @Qualifier annotation?

37.What is @Primary annotation?

38.What is circular dependency? How to resolve it?

39.What are bean scopes in Spring?

40.What is the difference between Singleton and Prototype scope?

41.What is AOP (Aspect-Oriented Programming)?

42.What are cross-cutting concerns?

43.What are the core AOP concepts (Aspect, Advice, Pointcut, JoinPoint)?

44.What is @Aspect annotation?

45.What are different types of Advice (Before, After, Around, AfterReturning, AfterThrowing)?

46.What is Spring MVC?

47.Explain the MVC architecture/flow

48.What is DispatcherServlet?

49.What is @Controller annotation?

50.What is @RestController? How is it different from @Controller?

51.What is @RequestMapping annotation?

52.What are @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping?

53.What is @PathVariable annotation?

54.What is @RequestParam annotation?

55.What is the difference between @PathVariable and @RequestParam?

56.What is @RequestBody annotation?

57.What is @ResponseBody annotation?

58.What is ResponseEntity? Why use it?

59.What is HttpStatus enum?

60.How do you return different HTTP status codes?

61.What is Content Negotiation in Spring MVC?

62.What are Servlets, JSP Files, and how are they related to Spring MVC?

63.What is Model, ModelAndView, and ModelMap?

64.What are View Resolvers?

65.What are Components in Spring MVC architecture?

66.What is @ComponentScan?

67.What is @Configuration?

68.What is @EnableAutoConfiguration?

69.What is @ConditionalOnProperty?

70.What is @ConditionalOnClass?

71.What is @Lazy annotation?

72.What is @Scope annotation?

73.What is @PostConstruct and @PreDestroy?

74.What is @ResponseStatus?

75.What is @CrossOrigin?

76.What are bean scopes?

77.Explain Singleton scope

78.Explain Prototype scope

79.Explain Request and Session scope (in web applications)

80.What is the default bean scope?

81.What is spring-boot-starter-web?

82.What is spring-boot-starter-data-jpa?

83.What is spring-boot-starter-security?

84.What is spring-boot-starter-test?

85.What is spring-boot-starter-actuator?

86.How does Spring Boot auto-configuration work?

87.What is @Conditional annotation?

88.How do you disable specific auto-configuration?

89.What is the embedded server in Spring Boot?

90.What are Tomcat, Jetty, and Undertow?

91.How do you change the default embedded server?

92.How do you change the default port (8080)?

93.How do you deploy Spring Boot as WAR file?

94.What is the difference between JAR and WAR deployment?

95.What is Spring Boot Actuator?

96.What are actuator endpoints?

97.What is /health endpoint?

98.What is /info endpoint?

99.What is /metrics endpoint?

100.How do you enable/disable actuator endpoints?

101.How do you secure actuator endpoints?

102.How do you create custom actuator endpoints?

103.What is the use of actuator in production?

104.What is Spring Security?

105.What is Authentication vs Authorization?

106.What is @EnableWebSecurity?

107.How do you configure Spring Security?

108.What is SecurityFilterChain?

109.What is UserDetailsService?

110.What is PasswordEncoder?

111.How do you implement in-memory authentication?

112.How do you implement database authentication?

113.What is JWT (JSON Web Token)?

114.How do you implement JWT authentication?

115.What is OAuth2?

116.What is the difference between OAuth2 and JWT?

117.What are authentication filters in Spring Security?

118.What is CSRF protection?

119.What is CORS? How do you configure it?

120.What is Spring Data?

121.What is Spring Data JPA?

122.What is the difference between JPA and Hibernate?

123.What is ORM (Object-Relational Mapping)?

124.What is @Entity annotation?

125.What is @Table annotation?

126.What is @Id annotation?

127.What is @GeneratedValue? What are generation strategies?

128.What is @Column annotation?

129.What is CrudRepository?

130.What is JpaRepository?

131.What is PagingAndSortingRepository?

132.What is the difference between CrudRepository, JpaRepository, and PagingAndSortingRepository?

133.What are derived query methods? (findBy, deleteBy, countBy)

134.What is @Query annotation?

135.What is the difference between JPQL and Native queries?

136.What is named query?

137.How do you implement pagination and sorting?

138.What is Pageable interface?

139.What is @Transactional annotation?

140.What are transaction propagation levels?

141.What are transaction isolation levels?

142.What is the difference between save() and saveAndFlush()?

143.What is the difference between findById() and getById()?

144.What is Entity Lifecycle (Transient, Persistent, Detached, Removed)?

145.What is Lazy Loading vs Eager Loading?

146.What is @OneToOne, @OneToMany, @ManyToOne, @ManyToMany?

147.What is the N+1 query problem? How to solve it?

148.What is @EntityGraph?

149.What is the Second Level Cache in Hibernate?

150.What is Spring Data MongoDB?

151.How is MongoDB different from relational databases?

152.What is Spring Data JDBC?

153.What is the difference between Spring Data JPA and Spring Data JDBC?

154.When to use JPA vs JDBC?

155.How do you handle exceptions in Spring Boot?

156.What is @ExceptionHandler?

157.What is @ControllerAdvice?

158.What is @RestControllerAdvice?

159.What is the difference between @ControllerAdvice and @RestControllerAdvice?

160.How do you return custom error responses?

161.What is ResponseEntityExceptionHandler?

162.What is Bean Validation?

163.What are validation annotations? (@NotNull, @NotEmpty, @NotBlank, etc.)

164.What is @Valid annotation?

165.What is @Validated annotation?

166.What is the difference between @Valid and @Validated?

167.What is BindingResult?

168.How do you create custom validators?

169.How do you handle validation errors globally?

170.How do you test Spring Boot applications?

171.What is @SpringBootTest?

172.What is @WebMvcTest?

173.What is @DataJpaTest?

174.What is the difference between @SpringBootTest and @WebMvcTest?

175.What is @MockBean?

176.What is the difference between @Mock and @MockBean?

177.What is MockMvc?

178.How do you test REST controllers?

179.What is TestRestTemplate?

180.What is @AutoConfigureMockMvc?

181.What is JPA Test and how to use @DataJpaTest?

182.What is Mock MVC testing?

183.How do you test service layer?

184.What is @SpringBootTest annotation attributes?

185.What are Microservices?

186.What is Spring Cloud?

187.What is Service Discovery?

188.What is Eureka Server?

189.How do you register microservices with Eureka?

190.What is API Gateway?

191.What is Spring Cloud Gateway?

192.What is Circuit Breaker pattern?

193.What is Resilience4j?

194.What is Hystrix? (deprecated but still asked)

195.What is Spring Cloud Config?

196.How do you implement centralized configuration?

197.What is Config Server?

198.What is Feign Client?

199.What is Spring Cloud OpenFeign?

200.What is Load Balancing?

201.What is the difference between Ribbon and Spring Cloud LoadBalancer?

202.What is distributed tracing?

203.What is Spring Cloud Sleuth and Zipkin?

204.What is service mesh?

205.What is Caching in Spring Boot?

206.What is @Cacheable, @CachePut, @CacheEvict?

207.What cache providers are supported? (Ehcache, Redis, Hazelcast)

208.What is Spring Batch?

209.What is Scheduling in Spring Boot?

210.What is @Scheduled annotation?

211.What is Async processing in Spring Boot?

212.What is @Async annotation?

213.What is @EnableAsync?

214.How do you handle file upload in Spring Boot?

215.How do you handle file download?

216.What is MultipartFile?

217.What is CORS configuration?

218.How do you implement internationalization (i18n)?

219.What is MessageSource?

220.How to connect to database? (DataSource configuration)

221.How to deploy Spring Boot application?

222.What is the difference between findById() and findOne()?

223.What is the role of @Primary?

224.How to disable specific Auto-configuration classes?

225.Why is Constructor Injection preferred over Field Injection?