All question banksWeb Development
Spring Boot Questions Comprehensive Spring Boot guide covering Introduction, Architecture, Configuration, and IoC/DI. Each answer is technically rigorous for professional interviews.
1. What is Spring Boot? Why use it? Beginner 2. What are the advantages of Spring Boot over Spring Framework? Beginner 3. What is auto-configuration in Spring Boot? Intermediate 4. How does auto-configuration work internally? Advanced 5. What is @SpringBootApplication annotation? What does it combine? Beginner 6. What are Spring Boot Starters? List important ones Beginner 7. What is the difference between Spring, Spring MVC, and Spring Boot? Intermediate 8. What is convention over configuration? Beginner 9. What is embedded server? Which servers are supported? Beginner 10. How do you create a Spring Boot application? Beginner 11. Explain Spring Boot Architecture (Layered Architecture) Intermediate 12. What is application.properties vs application.yml? Beginner 13. What is the property loading order/hierarchy in Spring Boot? Advanced 14. How do you externalize configuration? Intermediate 15. What is @Value annotation? Beginner 16. What is @ConfigurationProperties? Intermediate 17. What is the difference between @Value and @ConfigurationProperties? Intermediate 18. What are Spring profiles? Beginner 19. How do you activate profiles? Intermediate 20. What is @Profile annotation? Intermediate 21. What is @PropertySource annotation? Advanced 22. How do you use environment-specific properties files? Beginner 23. What is application-dev.properties vs application-prod.properties? Beginner 24. How do you override properties from command line? Intermediate 25. What is Spring Boot DevTools? What features does it provide? Intermediate 26. What is IoC (Inversion of Control)? Beginner 27. What is Dependency Injection? Beginner 28. What are the types of Dependency Injection? Intermediate 29. What is Constructor Injection vs Setter Injection vs Field Injection? Intermediate 30. Which injection type is recommended and why? Advanced 31. What is @Autowired annotation? Beginner 32. What is @Component annotation? Beginner 33. What is the difference between @Component, @Service, @Repository, and @Controller? Intermediate 34. What is @Bean annotation? Intermediate 35. What is the difference between @Component and @Bean? Intermediate 36. What is @Qualifier annotation? Advanced 37. What is @Primary annotation? Intermediate 38. What is circular dependency? How to resolve it? Advanced 39. What are bean scopes in Spring? Intermediate 40. What is the difference between Singleton and Prototype scope? Advanced 41. What is AOP (Aspect-Oriented Programming)? Intermediate 42. What are cross-cutting concerns? Intermediate 43. What are the core AOP concepts (Aspect, Advice, Pointcut, JoinPoint)? Advanced 44. What is @Aspect annotation? Intermediate 45. What are different types of Advice (Before, After, Around, AfterReturning, AfterThrowing)? Advanced 46. What is Spring MVC? Beginner 47. Explain the MVC architecture/flow Intermediate 48. What is DispatcherServlet? Advanced 49. What is @Controller annotation? Beginner 50. What is @RestController? How is it different from @Controller? Intermediate 51. What is @RequestMapping annotation? Beginner 52. What are @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping? Beginner 53. What is @PathVariable annotation? Beginner 54. What is @RequestParam annotation? Beginner 55. What is the difference between @PathVariable and @RequestParam? Intermediate 56. What is @RequestBody annotation? Intermediate 57. What is @ResponseBody annotation? Intermediate 58. What is ResponseEntity? Why use it? Advanced 59. What is HttpStatus enum? Beginner 60. How do you return different HTTP status codes? Intermediate 61. What is Content Negotiation in Spring MVC? Advanced 62. What are Servlets, JSP Files, and how are they related to Spring MVC? Intermediate 63. What is Model, ModelAndView, and ModelMap? Intermediate 64. What are View Resolvers? Advanced 65. What are Components in Spring MVC architecture? Intermediate 66. What is @ComponentScan? Beginner 67. What is @Configuration? Beginner 68. What is @EnableAutoConfiguration? Intermediate 69. What is @ConditionalOnProperty? Advanced 70. What is @ConditionalOnClass? Advanced 71. What is @Lazy annotation? Intermediate 72. What is @Scope annotation? Intermediate 73. What is @PostConstruct and @PreDestroy? Beginner 74. What is @ResponseStatus? Intermediate 75. What is @CrossOrigin? Intermediate 76. What are bean scopes? Beginner 77. Explain Singleton scope Beginner 78. Explain Prototype scope Intermediate 79. Explain Request and Session scope (in web applications) Intermediate 80. What is the default bean scope? Beginner 81. What is spring-boot-starter-web? Beginner 82. What is spring-boot-starter-data-jpa? Beginner 83. What is spring-boot-starter-security? Beginner 84. What is spring-boot-starter-test? Beginner 85. What is spring-boot-starter-actuator? Beginner 86. How does Spring Boot auto-configuration work? Intermediate 87. What is @Conditional annotation? Intermediate 88. How do you disable specific auto-configuration? Intermediate 89. What is the embedded server in Spring Boot? Beginner 90. What are Tomcat, Jetty, and Undertow? Intermediate 91. How do you change the default embedded server? Intermediate 92. How do you change the default port (8080)? Beginner 93. How do you deploy Spring Boot as WAR file? Advanced 94. What is the difference between JAR and WAR deployment? Intermediate 95. What is Spring Boot Actuator? Beginner 96. What are actuator endpoints? Intermediate 97. What is /health endpoint? Beginner 98. What is /info endpoint? Beginner 99. What is /metrics endpoint? Intermediate 100. How do you enable/disable actuator endpoints? Intermediate 101. How do you secure actuator endpoints? Advanced 102. How do you create custom actuator endpoints? Advanced 103. What is the use of actuator in production? Intermediate 104. What is Spring Security? Beginner 105. What is Authentication vs Authorization? Beginner 106. What is @EnableWebSecurity? Intermediate 107. How do you configure Spring Security? Intermediate 108. What is SecurityFilterChain? Advanced 109. What is UserDetailsService? Intermediate 110. What is PasswordEncoder? Beginner 111. How do you implement in-memory authentication? Beginner 112. How do you implement database authentication? Intermediate 113. What is JWT (JSON Web Token)? Intermediate 114. How do you implement JWT authentication? Advanced 115. What is OAuth2? Advanced 116. What is the difference between OAuth2 and JWT? Advanced 117. What are authentication filters in Spring Security? Advanced 118. What is CSRF protection? Intermediate 119. What is CORS? How do you configure it? Intermediate 120. What is Spring Data? Beginner 121. What is Spring Data JPA? Beginner 122. What is the difference between JPA and Hibernate? Intermediate 123. What is ORM (Object-Relational Mapping)? Beginner 124. What is @Entity annotation? Beginner 125. What is @Table annotation? Beginner 126. What is @Id annotation? Beginner 127. What is @GeneratedValue? What are generation strategies? Intermediate 128. What is @Column annotation? Beginner 129. What is CrudRepository? Beginner 130. What is JpaRepository? Intermediate 131. What is PagingAndSortingRepository? Intermediate 132. What is the difference between CrudRepository, JpaRepository, and PagingAndSortingRepository? Advanced 133. What are derived query methods? (findBy, deleteBy, countBy) Intermediate 134. What is @Query annotation? Intermediate 135. What is the difference between JPQL and Native queries? Intermediate 136. What is named query? Advanced 137. How do you implement pagination and sorting? Intermediate 138. What is Pageable interface? Intermediate 139. What is @Transactional annotation? Intermediate 140. What are transaction propagation levels? Advanced 141. What are transaction isolation levels? Advanced 142. What is the difference between save() and saveAndFlush()? Advanced 143. What is the difference between findById() and getById()? Intermediate 144. What is Entity Lifecycle (Transient, Persistent, Detached, Removed)? Advanced 145. What is Lazy Loading vs Eager Loading? Intermediate 146. What is @OneToOne, @OneToMany, @ManyToOne, @ManyToMany? Intermediate 147. What is the N+1 query problem? How to solve it? Advanced 148. What is @EntityGraph? Advanced 149. What is the Second Level Cache in Hibernate? Advanced 150. What is Spring Data MongoDB? Intermediate 151. How is MongoDB different from relational databases? Intermediate 152. What is Spring Data JDBC? Intermediate 153. What is the difference between Spring Data JPA and Spring Data JDBC? Advanced 154. When to use JPA vs JDBC? Intermediate 155. How do you handle exceptions in Spring Boot? Intermediate 156. What is @ExceptionHandler? Beginner 157. What is @ControllerAdvice? Intermediate 158. What is @RestControllerAdvice? Intermediate 159. What is the difference between @ControllerAdvice and @RestControllerAdvice? Intermediate 160. How do you return custom error responses? Intermediate 161. What is ResponseEntityExceptionHandler? Advanced 162. What is Bean Validation? Beginner 163. What are validation annotations? (@NotNull, @NotEmpty, @NotBlank, etc.) Beginner 164. What is @Valid annotation? Intermediate 165. What is @Validated annotation? Advanced 166. What is the difference between @Valid and @Validated? Advanced 167. What is BindingResult? Intermediate 168. How do you create custom validators? Advanced 169. How do you handle validation errors globally? Advanced 170. How do you test Spring Boot applications? Beginner 171. What is @SpringBootTest? Intermediate 172. What is @WebMvcTest? Intermediate 173. What is @DataJpaTest? Intermediate 174. What is the difference between @SpringBootTest and @WebMvcTest? Advanced 175. What is @MockBean? Intermediate 176. What is the difference between @Mock and @MockBean? Advanced 177. What is MockMvc? Intermediate 178. How do you test REST controllers? Intermediate 179. What is TestRestTemplate? Advanced 180. What is @AutoConfigureMockMvc? Advanced 181. What is JPA Test and how to use @DataJpaTest? Intermediate 182. What is Mock MVC testing? Intermediate 183. How do you test service layer? Intermediate 184. What is @SpringBootTest annotation attributes? Advanced 185. What are Microservices? Beginner 186. What is Spring Cloud? Beginner 187. What is Service Discovery? Intermediate 188. What is Eureka Server? Intermediate 189. How do you register microservices with Eureka? Intermediate 190. What is API Gateway? Intermediate 191. What is Spring Cloud Gateway? Advanced 192. What is Circuit Breaker pattern? Advanced 193. What is Resilience4j? Intermediate 194. What is Hystrix? (deprecated but still asked) Intermediate 195. What is Spring Cloud Config? Advanced 196. How do you implement centralized configuration? Advanced 197. What is Config Server? Intermediate 198. What is Feign Client? Intermediate 199. What is Spring Cloud OpenFeign? Intermediate 200. What is Load Balancing? Beginner 201. What is the difference between Ribbon and Spring Cloud LoadBalancer? Advanced 202. What is distributed tracing? Advanced 203. What is Spring Cloud Sleuth and Zipkin? Advanced 204. What is service mesh? Expert 205. What is Caching in Spring Boot? Intermediate 206. What is @Cacheable, @CachePut, @CacheEvict? Intermediate 207. What cache providers are supported? (Ehcache, Redis, Hazelcast) Intermediate 208. What is Spring Batch? Advanced 209. What is Scheduling in Spring Boot? Beginner 210. What is @Scheduled annotation? Intermediate 211. What is Async processing in Spring Boot? Advanced 212. What is @Async annotation? Intermediate 213. What is @EnableAsync? Intermediate 214. How do you handle file upload in Spring Boot? Intermediate 215. How do you handle file download? Intermediate 216. What is MultipartFile? Beginner 217. What is CORS configuration? Intermediate 218. How do you implement internationalization (i18n)? Advanced 219. What is MessageSource? Intermediate 220. How to connect to database? (DataSource configuration) Beginner 221. How to deploy Spring Boot application? Beginner 222. What is the difference between findById() and findOne()? Intermediate 223. What is the role of @Primary? Intermediate 224. How to disable specific Auto-configuration classes? Advanced 225. Why is Constructor Injection preferred over Field Injection? Advanced