YouTube2Text

Deloitte Interview | Java 8 | Spring Boot | Microservices | Cloud | Docker | SQL | NoSQL | 2–7 Years — Transcript

by Insights Instructor · 6,017 words · 999 segments · language en · Watch on YouTube

Full transcript

  1. 0:01Okay, so can you introduce yourself and
  2. 0:05your recent project briefly? Yeah, hi.
  3. 0:08So, I have around 3 years of experience
  4. 0:10in software development and currently
  5. 0:12I'm working with Accenture. And I have
  6. 0:15been primarily working in the BFSI
  7. 0:18domain and focusing on the backend
  8. 0:20development using the Java Spring Boot
  9. 0:22and microservices architecture. And in
  10. 0:24my recent project, I was the part of
  11. 0:27financial risk monitoring system
  12. 0:29designed to
  13. 0:30detect and prevent the suspicious
  14. 0:33transactions. And the application
  15. 0:35process
  16. 0:36this application basically processes the
  17. 0:38large volumes of transaction data in
  18. 0:40real time and applies the business rules
  19. 0:42to identify potential fraud patterns.
  20. 0:45And my responsibilities basically
  21. 0:47include in the developing REST APIs,
  22. 0:49implementing
  23. 0:51security using the Spring Security and
  24. 0:53JWT, and also handling the database
  25. 0:55interaction using the Spring Data JPA,
  26. 0:58and optimizing the performance for
  27. 1:00high-throughput scenarios. And along
  28. 1:03with that, I also work closely with
  29. 1:05cross-functional teams for requirement
  30. 1:07analysis, code reviews, and deployment
  31. 1:11activities, and to ensure the
  32. 1:13high-quality and scalable solutions. So,
  33. 1:15yeah, so this is what is all about
  34. 1:17myself and my recent project.
  35. 1:19>> Okay, so can you explain the
  36. 1:22architecture of your project? Yeah,
  37. 1:25sure. So, in my project, like we
  38. 1:27followed a microservices architecture in
  39. 1:30instead of a monolithic approach. So,
  40. 1:31because it gives like better scalability
  41. 1:34and flexibility.
  42. 1:35>> [snorts]
  43. 1:35>> So, that is why we used a microservices.
  44. 1:38And the application was basically
  45. 1:40divided into multiple small services
  46. 1:42like we had transaction service layer,
  47. 1:45and then user service, then risk
  48. 1:48analysis service,
  49. 1:49and also there were multiple other
  50. 1:51services as well. And each service was
  51. 1:53independently deployable. So, we had an
  52. 1:55API gateway at the entry point and that
  53. 1:58basically handled the request routing
  54. 2:00and authentication and basic validations
  55. 2:02as well before forwarding the request to
  56. 2:04the respective microservices. And uh
  57. 2:08for communication between the services,
  58. 2:10we mostly used REST APIs for uh
  59. 2:13synchronous calls. And in some cases, we
  60. 2:15used asynchronous messaging to handle
  61. 2:18heavy or background processing so that
  62. 2:21the system remains responsive. And each
  63. 2:24microservices had its own database to
  64. 2:26maintain loose coupling. And we mainly
  65. 2:29also used a
  66. 2:31relational databases like MySQL for
  67. 2:34storing the structured data such as like
  68. 2:37transactional and user details. So,
  69. 2:39yeah, so this design basically helped us
  70. 2:41to like make the things more scalable
  71. 2:44and dual services and load and also made
  72. 2:47the system easier to maintain and
  73. 2:49enhance. So, yeah. Okay, so can you tell
  74. 2:52me why did you choose microservices over
  75. 2:56the monolithic architecture? Yeah, so in
  76. 2:59our case, the system had like multiple
  77. 3:02functionalities like transaction
  78. 3:03processing, user management, and risk
  79. 3:05analysis and all as I told you. So,
  80. 3:08using microservices like that actually
  81. 3:11made it easier to split these into the
  82. 3:14independent services. And this basically
  83. 3:17helped us to scale only the required
  84. 3:20part instead of the whole application.
  85. 3:24So, also the deployment became like kind
  86. 3:27of easier because the changes in one
  87. 3:30service did not impact the entire
  88. 3:32system. So, that basically usually a
  89. 3:35problem
  90. 3:36it was a problem in the
  91. 3:38multi-architecture.
  92. 3:39So, that is the reason why we thought to
  93. 3:42use microservices. So, yeah.
  94. 3:44>> Okay, fine.
  95. 3:46And how does your API gateway work and
  96. 3:51which one did you use? Can you tell me?
  97. 3:53Yeah, so basically we used Spring Cloud
  98. 3:57Gateway
  99. 3:58as our API gateway. So, it acts as a
  100. 4:04single entry point for all client
  101. 4:06requests. And it basically handles the
  102. 4:09routing the request to the correct
  103. 4:11microservices. And also applies the
  104. 4:14filters like authentication, logging,
  105. 4:16and request validation.
  106. 4:18So, instead of exposing all services
  107. 4:21directly, like everything goes through
  108. 4:25the gateway. So, that basically
  109. 4:26ultimately improves the security and
  110. 4:28control.
  111. 4:29So, that's that is how we used the API
  112. 4:32gateway. Okay, so can you tell me the
  113. 4:35full API request flow? How it flows from
  114. 4:39starting to end? Yeah, sure. So, in my
  115. 4:42project, like
  116. 4:44wherever a client sends a request, for
  117. 4:46example, through Postman or from the
  118. 4:49front end, then it first reaches the API
  119. 4:51gateway where all basic validations and
  120. 4:54authentication checks are applied. And
  121. 4:56after that, the request is forwarded to
  122. 4:59the respective microservices and enters
  123. 5:02the Spring Boot application through the
  124. 5:04dispatcher servlet.
  125. 5:06So, that basically acts as the front
  126. 5:08controller. And from there, it passes
  127. 5:11through the chain of filters.
  128. 5:13So, especially the Spring Security
  129. 5:15filters and all. So, where
  130. 5:17authentication and authorization are
  131. 5:18handled using the JWT tokens.
  132. 5:21So, [snorts] once the request is
  133. 5:23validated, then it reaches the
  134. 5:26controller layer and that basically maps
  135. 5:28the incoming request to the appropriate
  136. 5:31endpoint.
  137. 5:32So, the controller has like then like
  138. 5:36delegates the request to the service
  139. 5:38layer. And there the actual like we can
  140. 5:42see the all business logic is written.
  141. 5:44And the service layer basically after
  142. 5:47that interacts with the repository layer
  143. 5:49to perform the database operations using
  144. 5:51the JPA or Hibernate, whatever we are
  145. 5:53using.
  146. 5:54So, after processing, the response flows
  147. 5:57back again from the repository to the
  148. 6:00service and to the controller there, and
  149. 6:03finally it is sent back to the client as
  150. 6:05HTTP response.
  151. 6:06So, in the response, it can be like JSON
  152. 6:08or XML, whatever the format we have.
  153. 6:10Though usually we are using JSON one.
  154. 6:12So, in the JSON format, it will be sent.
  155. 6:14So, this is how the whole flows like
  156. 6:17works from request to controller,
  157. 6:20service layer, and then repository,
  158. 6:22again database, and again back to the
  159. 6:25whatever request we had sent. So,
  160. 6:27yeah, so that is how it works. Okay, can
  161. 6:30you tell me
  162. 6:32where exactly does Spring Security come
  163. 6:35into the flow?
  164. 6:37Like before dispatcher servlet or after?
  165. 6:40Yeah, so in the request flow, like
  166. 6:43Spring Security actually comes into play
  167. 6:46before the request reaches the
  168. 6:48dispatcher servlet. So, it works through
  169. 6:50a chain of filters which are part of the
  170. 6:55servlet filter mechanism. So, when a
  171. 6:57request comes in, it first goes through
  172. 7:00the like these security filters where
  173. 7:02authentication and authorization checks
  174. 7:04are performed. So, for example, like
  175. 7:06validating the JWT token. If the request
  176. 7:09is valid, then only then it is allowed
  177. 7:12to the to proceed further to the
  178. 7:14dispatcher servlet and eventually to the
  179. 7:17controller. So, like if authentication
  180. 7:20fails, then the request is blocked at
  181. 7:22the filter level itself. And like we
  182. 7:25have multiple error
  183. 7:27like responses like 401 or 403. So, that
  184. 7:31is returned. And like it never basically
  185. 7:33reaches to the controller. So, yeah, so
  186. 7:35that is how we implement this Spring
  187. 7:37Security. Okay, so can you tell me how
  188. 7:40does Spring decides like which
  189. 7:43controller method to call? Yeah, sure.
  190. 7:45So, Spring decides like which controller
  191. 7:48method to call based on the request
  192. 7:49mapping defined in the controller
  193. 7:51classes. So, basically there the request
  194. 7:54reaches the dispatcher servlet and it
  195. 7:56looks at the like in the URL, whatever
  196. 7:59URL we give. So, it looks at the URL and
  197. 8:02HTTP methods like get, post, or any
  198. 8:06other, and then it matches it with the
  199. 8:08mapping
  200. 8:10and define using the we we will be
  201. 8:13having the annotations like at the rate
  202. 8:15of request mapping, get mapping, post
  203. 8:17mapping, and all in the controller
  204. 8:19class. And these mappings are handled by
  205. 8:21something called like handler mapping
  206. 8:23internally. And that basically feels the
  207. 8:27correct
  208. 8:28controller and method that matches the
  209. 8:30request path and method type. And once
  210. 8:33the correct method is identified, then
  211. 8:36Spring invokes that method and also um
  212. 8:39takes care of binding the request data
  213. 8:41like JSON body or query parameter and
  214. 8:45all to the method argument
  215. 8:47automatically.
  216. 8:48So, yeah, so that is how Spring decides
  217. 8:51like which controller method to call.
  218. 8:53Yeah. Okay, so can you tell me where
  219. 8:55filters come into picture?
  220. 8:58And also can a request reach controller
  221. 9:01without passing the filter? Do you Do we
  222. 9:04have any option like that? Actually,
  223. 9:07filters comes into picture right at the
  224. 9:10very beginning of the request life
  225. 9:12cycle. So, even before the request reach
  226. 9:14to the dispatcher servlet, then itself
  227. 9:17the filter is executed. And they are the
  228. 9:19part of servlet container and and
  229. 9:23like form a filter chain through which
  230. 9:26like every incoming request must pass.
  231. 9:29Okay, so we cannot bypass it actually.
  232. 9:31So, this is where the things like
  233. 9:33authentication, authorization, logging,
  234. 9:35and request validations are handled. And
  235. 9:38especially in a Spring Security. So,
  236. 9:40particularly a request cannot reach the
  237. 9:43controller without going through the
  238. 9:46filters. So, it may filter like
  239. 9:49if suppose if any filter blocks the
  240. 9:52request, so for example, due to failed
  241. 9:53authentication or something, then the
  242. 9:55flow stops there itself and the is never
  243. 9:58reached. So, that is how this whole flow
  244. 10:01works. And what about the exception
  245. 10:04handling? So, where does this exception
  246. 10:06handling happens in the flow? Yeah, so
  247. 10:09like in the like whole flow like
  248. 10:11exception handling usually happens after
  249. 10:14the request reaches the controller or
  250. 10:17service layer, and something goes wrong
  251. 10:19during the processing. So, instead of
  252. 10:21handling exceptions in
  253. 10:24every controller method, we usually like
  254. 10:27generally use a global exception handler
  255. 10:29like we have at the rate of controller
  256. 10:31advice. So, that we use, and this allows
  257. 10:34us to catch like any kind of different
  258. 10:36types of exceptions in a centralized
  259. 10:39place and return a proper consistent
  260. 10:41HTTP responses like we have 404 or like
  261. 10:44400 or 500, whatever it may be. So, with
  262. 10:46a meaningful message actually.
  263. 10:48So, we do that way. And so, if any
  264. 10:51exception is thrown in the controller or
  265. 10:53service layer, then it gets inter-
  266. 10:55cepted by the global exception handler
  267. 10:56before the response is sent back to the
  268. 10:58client. So, that is how this global
  269. 11:01exception handling works. Yeah. Okay,
  270. 11:02have you heard of interceptor, or can
  271. 11:05you tell me what is the difference
  272. 11:06between filter and interceptor? Yeah,
  273. 11:09like the main difference between filter
  274. 11:11and interceptor is where they are used
  275. 11:14and what level they operate on, okay?
  276. 11:18So, filters [snorts]
  277. 11:19are part of servlet container
  278. 11:21and work at the lower level. So, they
  279. 11:25are executed before the request reaches
  280. 11:28to the servlet reaches servlet, okay?
  281. 11:30And they are mainly used for things like
  282. 11:32authentication, logging, or modifying
  283. 11:34the request. Okay, and they also apply
  284. 11:38to all types of requests. So, not just
  285. 11:41like a Spring specific request. So, it
  286. 11:42is a like kind of general thing, okay?
  287. 11:45So,
  288. 11:46on the other hand, interceptors are like
  289. 11:48the part of a Spring framework and work
  290. 11:51at the Spring MVC level only, okay? So,
  291. 11:53they come into picture after the
  292. 11:56dispatcher servlet is there, and but
  293. 11:58before the controller method is
  294. 12:00executed. So, they come there, okay? So,
  295. 12:02interceptors are basically like more
  296. 12:04suited for the task like pre-processing
  297. 12:07and post-processing around the
  298. 12:09controller logic. And such as adding
  299. 12:12models attributes and or handling
  300. 12:14authorization checks and specific to the
  301. 12:17controller methods. So, there we use
  302. 12:19more for this, yeah. Okay, so can you
  303. 12:21tell me where does serialization and
  304. 12:24deserialization
  305. 12:25>> happen? Yeah, serialization and
  306. 12:26deserialization mainly happen at the
  307. 12:28controller layer in the Spring Boot
  308. 12:30application. So, when a client sends the
  309. 12:33request with a JSON body, then a Spring
  310. 12:36automatically converts that JSON into
  311. 12:38Java object before passing it to the
  312. 12:41controller method. And this basically
  313. 12:44processes is like this process basically
  314. 12:47called is the deserialization. So,
  315. 12:48similarly, when the controller returns
  316. 12:50the respective response object, and the
  317. 12:52Spring converts that Java object back to
  318. 12:55the JSON
  319. 12:56before sending it to the client. So,
  320. 13:00like
  321. 13:01then this basically this process is
  322. 13:02called the serialization. So, this is
  323. 13:04basically handled internally by the HTTP
  324. 13:07message converters, and by default
  325. 13:09Spring uses the like we have the I think
  326. 13:12Jackson library is there. So, that is
  327. 13:14used to perform these conversions, okay?
  328. 13:16So, we usually don't need to write any
  329. 13:19manual code for this, and it
  330. 13:21automatically converts
  331. 13:23to the JSON, yeah. Okay, so can you tell
  332. 13:25me
  333. 13:27what is the difference between
  334. 13:29authentication and authorization? Yeah,
  335. 13:32authentication and authorization are
  336. 13:34like two different steps in the security
  337. 13:36processes. So, authentication is about
  338. 13:39like
  339. 13:39verifying like who is the user, okay?
  340. 13:43So, typically by checking the
  341. 13:45credentials like username and password
  342. 13:47during the login, so we can identify if
  343. 13:50the these credentials are correct or
  344. 13:52not. So, this is basically called the
  345. 13:54authentication. And once the user is
  346. 13:56authenticated, then authorization comes
  347. 13:58into picture. So, that basically
  348. 14:00determines what like that user is
  349. 14:04allowed to access or perform in the
  350. 14:06system, okay? So, for example, after
  351. 14:08logging like a normal user might have
  352. 14:11access to like basic features, while an
  353. 14:14admin user can like access additional
  354. 14:17functionalities based on their roles and
  355. 14:19permissions, okay? So, yeah, so that's
  356. 14:21the main difference between these two
  357. 14:23like authentication and authorization.
  358. 14:25Okay, so can you tell me what is auto
  359. 14:28configuration in Spring Boot? Yeah, auto
  360. 14:30configuration basically means like the
  361. 14:32Spring Boot automatically configures the
  362. 14:35application based on the dependencies
  363. 14:38present in the class path.
  364. 14:40So, for example, if we add a web
  365. 14:42dependency, then it automatically sets
  366. 14:44up the things like dispatcher servlet
  367. 14:47and like embedded server.
  368. 14:49So, this basically reduces the manual
  369. 14:51configuration and makes the development
  370. 14:53faster.
  371. 14:54So, yeah, so that's what is the auto
  372. 14:56configuration in Spring Boot, yeah.
  373. 14:58Okay, and what is the difference between
  374. 15:00component, service, and repository
  375. 15:03annotation? Yeah, so
  376. 15:04this component, service, and repository
  377. 15:06like all three are the stereotype
  378. 15:08annotation, and it is used for component
  379. 15:11scanning, but they have different
  380. 15:13purposes. So, at component is a generic
  381. 15:16annotation, and at service is used for
  382. 15:18the service layer, like where the
  383. 15:21business logic is written. And at
  384. 15:24repository is used for the data access
  385. 15:26layer, okay? And also like at the rate
  386. 15:28of repository provides the additional
  387. 15:30benefits like exception
  388. 15:32like
  389. 15:33translation for the database operations
  390. 15:35and all.
  391. 15:36So, yeah, so that's what are the these
  392. 15:39annotations, yeah. And what is
  393. 15:40dependency injection?
  394. 15:43Yeah, dependency injection is a design
  395. 15:45pattern we can say like where objects
  396. 15:48are provided with their dependencies
  397. 15:50instead of the creating them manually,
  398. 15:53okay? So, in a Spring like this is
  399. 15:56managed by the container, and like that
  400. 15:59basically helps in loose coupling and
  401. 16:02like easier testing,
  402. 16:04okay? So, we usually use like
  403. 16:08constructor injection as like it is more
  404. 16:10recommended, and it makes the code like
  405. 16:14more maintainable, yeah. Okay, so
  406. 16:17as you said that constructor injection
  407. 16:19is more recommended, so can you tell me
  408. 16:22why?
  409. 16:23>> Yeah, so constructor injection is
  410. 16:25generally more recommended because like
  411. 16:27it makes the
  412. 16:29dependencies of a class explicit and
  413. 16:32ensures that the object is always
  414. 16:34created in a valid state, okay? So, when
  415. 16:37we use constructor injection, then all
  416. 16:39required dependencies are provided at
  417. 16:42the time of the object creation. So,
  418. 16:45there is no chance of having null or
  419. 16:47like uninitialized fields later on,
  420. 16:50okay? So, like it also promotes like you
  421. 16:54can say immutability, okay? So, because
  422. 16:56we can mark the dependencies as final,
  423. 17:00so that basically improves the code
  424. 17:02safety and clarity. So, like another
  425. 17:05advantage we can say is like that it
  426. 17:07makes the classes like easier to test,
  427. 17:11and since we can directly pass mock uh
  428. 17:15dependencies through the constructor
  429. 17:17without relying on the Spring container,
  430. 17:21so overall like
  431. 17:23it leads to cleaner and more
  432. 17:25maintainable code. So, yeah. Okay, so
  433. 17:28can you tell me what is the difference
  434. 17:30between at controller and
  435. 17:33at the rate of rest controller? At
  436. 17:36controller and rest controller like
  437. 17:38the main difference in between these two
  438. 17:40is how they handle the response
  439. 17:42actually. So, at controller is typically
  440. 17:45used in traditional Spring MVC
  441. 17:47application where we
  442. 17:49return like views like JSP or HTML
  443. 17:54pages,
  444. 17:55and in this case the method usually
  445. 17:57returns the view name, and the view
  446. 18:00resolver maps it to the actual UI page.
  447. 18:04So, if we want to return data instead of
  448. 18:06view, then we have to use at the rate of
  449. 18:09response body on the method side, okay?
  450. 18:12And on the other hand like if on the
  451. 18:15other hand at the rate of rest
  452. 18:16controller is specially designed for the
  453. 18:18rest APIs where we directly return data
  454. 18:21in in the form of JSON or XML. So, yeah,
  455. 18:25so this is basically the combination of
  456. 18:28at controller and response body. So,
  457. 18:30that is what is the at the rate of rest
  458. 18:32controller. So, every method
  459. 18:34automatically returns the response
  460. 18:37body instead of the view. So, because of
  461. 18:39this for back-end services or
  462. 18:42microservices, we mostly use at the rate
  463. 18:45of rest controller as it simplifies like
  464. 18:49development and avoids the need to add
  465. 18:52like at the rate of response body on
  466. 18:54each method. So, yeah, so that's the
  467. 18:55difference between these two, yeah.
  468. 18:57Okay, so what is a Spring Data JPA?
  469. 19:01Yeah, Spring Data JPA is used to
  470. 19:03simplify database operations in a Spring
  471. 19:06Boot applications. So, instead of
  472. 19:09writing a lot of boilerplate code for
  473. 19:12CRUD operations, we can directly use
  474. 19:14repository interfaces like JPA
  475. 19:16repository.
  476. 19:18So, that is already like provide that
  477. 19:21already provide methods like save, find,
  478. 19:23delete, and all. So, it also supports
  479. 19:26the writing custom queries using the
  480. 19:29method naming conventions or like JPQL
  481. 19:32if required. So, internally it uses the
  482. 19:35Hibernate
  483. 19:36as the ORM tool to map Java objects to
  484. 19:40database tables. Yeah, so that is what
  485. 19:42is the Spring Data JPA, and it overall
  486. 19:45reduce the basically the development
  487. 19:48effort, and it improves the readability,
  488. 19:51and
  489. 19:52kinds of let's let's us focus more on
  490. 19:55the business logic rather than the
  491. 19:57database handling. So, yeah. Okay, and
  492. 20:00what is Eureka server in microservices?
  493. 20:03Yeah, Eureka server is used for the
  494. 20:06service discovery in microservices
  495. 20:08architecture. So, all the microservices
  496. 20:11register themselves with the Eureka
  497. 20:13server when they start and like when
  498. 20:17they have to send the like kind of
  499. 20:19heartbeat signals to indicate like they
  500. 20:21are alive. Okay, so other services can
  501. 20:25then discover these
  502. 20:27services using their names instead of
  503. 20:31hard coding IP addresses or URLs. So,
  504. 20:34this basically makes the system like
  505. 20:36kind of more flexible and especially
  506. 20:38when the services like scale up or down
  507. 20:41dynamically. Yeah, so that's what is the
  508. 20:43Eureka server in microservices. And what
  509. 20:46is circuit breaker in microservices?
  510. 20:49Yeah, circuit breaker is a design
  511. 20:50pattern used to handle failures between
  512. 20:53the
  513. 20:54microservices and prevent the cascading
  514. 20:58failures. And if one service is down or
  515. 21:02responding slowly, then the circuit
  516. 21:04breaker stops sending the request to
  517. 21:07that service after a certain threshold
  518. 21:09and like immediately returns the
  519. 21:11fallback response. Okay, so this
  520. 21:13basically helps in maintaining system
  521. 21:15like like system stability and prevents
  522. 21:18the entire system from getting impacted
  523. 21:21due to the
  524. 21:22like one single failing service. Okay,
  525. 21:25so once the service becomes healthy
  526. 21:27again, then the circuit breaker allows
  527. 21:29request to pass through again. Okay,
  528. 21:31yeah, so commonly tools we use for this
  529. 21:34is like resilience for J. So, that is
  530. 21:38mostly I have used to like implement
  531. 21:40this. Yeah. Okay, and what is Feign
  532. 21:42client?
  533. 21:43>> Yeah, Feign client is a like we can say
  534. 21:45declarative REST client
  535. 21:48that provided by the Spring Cloud and it
  536. 21:50makes the communication between
  537. 21:52microservices like much more easier.
  538. 21:54Okay, so instead of writing like manual
  539. 21:57HTTP calls and using REST template or
  540. 22:00like a web client, we can simply define
  541. 22:03an interface and annotate it with the
  542. 22:06like at the rate of Feign client and
  543. 22:08Spring automatically generates the
  544. 22:10implementation. Okay, so like it
  545. 22:13integrates well with service discovery.
  546. 22:16So, we can call services using their
  547. 22:19names instead of like URLs. Okay, so we
  548. 22:22don't have to use URLs in this case. So,
  549. 22:25ultimately this makes the code more
  550. 22:26cleaner and more readable and easier to
  551. 22:29maintain. So, that is what is the Feign
  552. 22:31client is. Yeah. Okay, and what is
  553. 22:33Docker and how do you use it in
  554. 22:36microservices? Yeah, Docker is a
  555. 22:38containerization tool. Okay, so that
  556. 22:41allows us to package an application
  557. 22:44along with all its dependencies into a
  558. 22:46container. So, like it can run
  559. 22:49consistently across different
  560. 22:51environments. So, yeah, that is what is
  561. 22:53the Docker and in microservices
  562. 22:54architecture like each service can be
  563. 22:57like containerized separately and
  564. 23:00deployed independently. Okay, so this
  565. 23:03basically makes the like deployment much
  566. 23:05more faster and more reliable and also
  567. 23:08helps in a scaling services easily. So,
  568. 23:11yeah, so Docker like
  569. 23:13we can say also works well with the
  570. 23:15orchestration tools like
  571. 23:17we have Kubernetes, right? So, we we use
  572. 23:20along with that and that basically helps
  573. 23:22in managing multiple container in
  574. 23:24production environments. So, that is
  575. 23:26what is the Docker. Yeah. Okay, so can
  576. 23:28you tell me how do you handle null
  577. 23:32values safely? Maybe how many ways are
  578. 23:34there? Yeah, so like in my project I
  579. 23:37handled the null values like there are
  580. 23:40few standard ways to avoid runtime
  581. 23:42issues like null pointer exception and
  582. 23:44all. So, first of all, I can like we can
  583. 23:47use proper null checks before
  584. 23:50like accessing any object especially
  585. 23:53when dealing with
  586. 23:55external inputs or database responses.
  587. 23:58So, in cases where null can lead to
  588. 24:02exceptions, we can use try catch blocks
  589. 24:05to handle them like and return
  590. 24:08meaningful errors
  591. 24:10error message instead of like breaking
  592. 24:12the whole application. And also like
  593. 24:15wherever possible, we can use optional
  594. 24:17class which has been introduced in Java
  595. 24:208.
  596. 24:20So, that basically helps in handling
  597. 24:23null values in a more clean and
  598. 24:26readable way by forcing
  599. 24:29us to explicitly deal the absence of the
  600. 24:32value instead of the directly accessing
  601. 24:34it. So, yeah, so these are the I think
  602. 24:36the approaches mostly I use to handle
  603. 24:39the null values safely. Yeah. Okay, so
  604. 24:42what are the other features of Java 8
  605. 24:46you know? Yeah, so there are various
  606. 24:49features of Java 8 as are there like
  607. 24:52one of the main feature is like lambda
  608. 24:54expression.
  609. 24:55So, basically that allows us to write
  610. 24:57shorter and cleaner code especially when
  611. 25:00working with collections. Along with
  612. 25:02that, the functional interfaces has been
  613. 25:05introduced. So, like which have only one
  614. 25:08abstract method and mainly used with the
  615. 25:10lambda expressions. And apart from that,
  616. 25:13we have a stream APIs and then we have
  617. 25:16the like various filters are there. Like
  618. 25:19we can use filters, maps and reduce. All
  619. 25:22that we can use along with this stream.
  620. 25:24And Java 8 also introduced the optional
  621. 25:27classes to handle so which like we
  622. 25:29already discussed and
  623. 25:32there were also like enhancements in
  624. 25:34interfaces where default and static
  625. 25:36methods were added. So, we can provide
  626. 25:38methods implementations inside the
  627. 25:40interfaces without breaking the existing
  628. 25:43code. Okay, and
  629. 25:45apart from that, the new date time API
  630. 25:47has been introduced. So, that is also
  631. 25:49one of the
  632. 25:50major enhancement. So, yeah, so these
  633. 25:53are the various
  634. 25:54features of the Java 8 are there. Okay,
  635. 25:57so how this date time API is better
  636. 26:00compared to the older versions of Java?
  637. 26:03Yeah, the Java 8 date time API is much
  638. 26:06better compared to older versions
  639. 26:07because it mainly it fixes the lots of
  640. 26:11problems that were there in the classes
  641. 26:13like date and calendar which were
  642. 26:15earlier used. So, earlier APIs were not
  643. 26:18thread safe. So, that means that if
  644. 26:20multiple threads were using them, it
  645. 26:23could lead to unexpected issues at that
  646. 26:25time. But the new API which comes under
  647. 26:28the java.time package so that is
  648. 26:31basically immutable and thread safe. So,
  649. 26:33it works like much better in the
  650. 26:36multi-threaded environments. And another
  651. 26:38improvement is that the old API was
  652. 26:41confusing and not very like kind of
  653. 26:43intuitive. So, for example, months were
  654. 26:46like zero based and months were not
  655. 26:48clearly named. So, in Java 8 like
  656. 26:51classes like local date and local time
  657. 26:53and local date time and all are there.
  658. 26:55So, that are much more clear and easy to
  659. 26:58use. Okay, and also handling the time
  660. 27:00zones was very difficult earlier. But
  661. 27:03now like this classes like zone date
  662. 27:07time has become like much more simpler.
  663. 27:09So, yeah, so formatting and passing
  664. 27:10dates is now much more better now using
  665. 27:13like this date time formatter. So, that
  666. 27:16basically is more flexible and thread
  667. 27:18safe compared to the older
  668. 27:21simple date format. Yeah, so overall the
  669. 27:24new date time like is more readable we
  670. 27:27can say and less error prone and
  671. 27:29performs much much better in
  672. 27:31like multi-threaded environment. Okay,
  673. 27:32can you tell me why is string is
  674. 27:34immutable? Yeah, so a string is
  675. 27:37immutable in Java because like basically
  676. 27:39it cannot be changed. So, once it is
  677. 27:41created, it cannot be changed. So, that
  678. 27:43is why we say that it is immutable. So,
  679. 27:45this design basically provides the
  680. 27:46multiple benefits
  681. 27:49to our our programming. So, for example,
  682. 27:52uh
  683. 27:53security
  684. 27:54and
  685. 27:55then performance. So, security because
  686. 27:57like since the strings are widely used
  687. 27:59in sensitive areas like paths and
  688. 28:01databases connections and all. So, like
  689. 28:03using this immutable string is kind of
  690. 28:06it provides the I mean good security to
  691. 28:08that. And it also improves the
  692. 28:10performance because the strings can be
  693. 28:12cached in a string pool and reused. So,
  694. 28:15yeah, so that is why it is like enhances
  695. 28:17the performance. And apart from that,
  696. 28:20additionally immutability makes the
  697. 28:22string thread safe. So, multiple threads
  698. 28:24can use them without synchronization.
  699. 28:26So, yeah, so that is why string is
  700. 28:28immutable. Okay, and what is the
  701. 28:29difference between array list and linked
  702. 28:31list? So,
  703. 28:34array list is based on the dynamic
  704. 28:35array. So, it provides the fast random
  705. 28:37access using the indexes. But insertion
  706. 28:40or deletion in the middle
  707. 28:42can be like slow because the elements
  708. 28:44need to be shifted. Okay, so that is
  709. 28:47what is about the array list. And linked
  710. 28:49list on the other hand a doubly linked
  711. 28:51list like a structure internally. So,
  712. 28:53insertion and deletions are faster
  713. 28:55especially in the middle. But accessing
  714. 28:57the elements takes more time because the
  715. 29:00whenever we try to access, then the
  716. 29:02traversal is traversal is required.
  717. 29:04Okay, so the choice basically depends on
  718. 29:06the use case like
  719. 29:08if it is read heavy or modification
  720. 29:10heavy. So, based on that, we decide like
  721. 29:12which one we have to use like array list
  722. 29:14or linked list.
  723. 29:16Yeah. Okay, and what is hash map and how
  724. 29:18it works internally in very brief can
  725. 29:21you tell me like what is the complexity
  726. 29:24and all? So, hash map basically stores
  727. 29:26the data in key value pairs and
  728. 29:30internally uses an arrays of buckets.
  729. 29:33So, when a key is inserted, its hash
  730. 29:36code is calculated and converted into an
  731. 29:39index where the entry will be stored.
  732. 29:42Okay, so if multiple keys map to the
  733. 29:44same bucket, so collision
  734. 29:47handling is done using a linked list or
  735. 29:50tree structure in Java 8. Okay? So,
  736. 29:53during retrieval, hash code is used
  737. 29:55again to find the bucket and then equals
  738. 29:58is used to find the extra key. So, this
  739. 30:00overall this makes the hash map like
  740. 30:02very efficient and
  741. 30:04its complexity will be like O of 1.
  742. 30:07Okay. And what is hash code and equals
  743. 30:10contract?
  744. 30:12Yeah, the
  745. 30:13contract states that if two objects are
  746. 30:17equal using equals method, then their
  747. 30:20hash [snorts] code must be the same.
  748. 30:22Okay? However, if two objects have the
  749. 30:25same hash code, then they are not
  750. 30:27necessarily equal. Okay? So, this
  751. 30:30contract is important because the hash
  752. 30:33based collections like hash map rely on
  753. 30:35its for like storing and retrieving
  754. 30:38objects correctly. Okay? So, if this
  755. 30:41contract is violated, then it can lead
  756. 30:43to incorrect behavior or data loss.
  757. 30:46Okay? So, that is what is the hash code
  758. 30:48and equals Okay. And what is the
  759. 30:49difference between
  760. 30:51hash map and concurrent hash map? Yeah,
  761. 30:53hash map is not thread safe. Okay? So,
  762. 30:56if multiple threads access it
  763. 30:58simultaneously, then it can lead to like
  764. 31:01inconsistent data. Okay? But concurrent
  765. 31:04hash map is designed for concurrent
  766. 31:07environments and it allows multiple
  767. 31:09threads to read and write safely. So,
  768. 31:12yeah. So, instead of locking the entire
  769. 31:15map, it uses the segment level or bucket
  770. 31:18level locking. So, that basically
  771. 31:19improves the performance compared to the
  772. 31:22synchronized maps.
  773. 31:23So, yeah. So, that is the difference
  774. 31:24between hash map and concurrent hash
  775. 31:26map. Okay. And what is fail fast and
  776. 31:30fail safe? Yeah, fail fast iterators
  777. 31:32like immediately throw concurrent
  778. 31:34modification exception if the collection
  779. 31:36is modified during the iteration.
  780. 31:38Basically, this is done to avoid the
  781. 31:40inconsistent behavior. So, fail fast
  782. 31:42iterators
  783. 31:43like on the other hand like it works on
  784. 31:46the copy of the collection and do not
  785. 31:47throw like any kind of exception because
  786. 31:49we create the copy and any kind of
  787. 31:51modification in while iterating that it
  788. 31:53does not throw any exception. Okay? So,
  789. 31:57but the problem is that we may not
  790. 32:00like see the latest changes in that in
  791. 32:02that case.
  792. 32:03Okay? But the but it will not throw any
  793. 32:06kind of exception. So, for example, we
  794. 32:08have array list. So, that is fail fast
  795. 32:09and then we have a concurrent hash map
  796. 32:12or copy on write array list. So, all of
  797. 32:15them are like fail safe. Okay? So,
  798. 32:17because they work on the copy of the
  799. 32:19object. Okay. And what is
  800. 32:21synchronization? Synchronization is used
  801. 32:24to control access to shared resources by
  802. 32:29multiple threads. So, it ensures that
  803. 32:31only one thread can execute
  804. 32:34critical section at a time that
  805. 32:36preventing prevents the data
  806. 32:38inconsistency. So, it can be applied at
  807. 32:41method level or block level, but
  808. 32:43excessive synchronization can reduce
  809. 32:45performance.
  810. 32:46So, yeah. So, that is what is the
  811. 32:48synchronization. And what is volatile
  812. 32:49keyword?
  813. 32:51Yeah, volatile basically ensures that
  814. 32:53the
  815. 32:54value of a variable is always read from
  816. 32:58the
  817. 32:59main memory, not from the thread cache.
  818. 33:02Okay? So, this ultimately guarantees
  819. 33:05like visibility of changes across the
  820. 33:07threads.
  821. 33:08But it does not provide the auto
  822. 33:10atomicity. So, it cannot be replaced
  823. 33:13it cannot replace synchronization
  824. 33:14completely, but yeah, we use for the for
  825. 33:17the visibility of the changes across the
  826. 33:18threads. Yeah.
  827. 33:19>> And what is class loader? Class loader.
  828. 33:21Yeah, class loader is responsible for
  829. 33:23loading classes into memory at run time.
  830. 33:25So, basically it follows a hierarchical
  831. 33:26design model with like bootstrap,
  832. 33:30extension and application class loader.
  833. 33:31So, that basically ensures that the
  834. 33:34security and avoids the duplicate class
  835. 33:36loading.
  836. 33:37So, that is what is the class loading.
  837. 33:39Yeah. And
  838. 33:40what is the difference between interface
  839. 33:43and abstract class in very brief? Yeah,
  840. 33:45interface is used for abstraction and
  841. 33:48supports multiple inheritance. While
  842. 33:51abstract class can have both abstract
  843. 33:53and concurrent methods and supports
  844. 33:55single inheritance. Okay? So, like
  845. 33:57interfaces are more flexible especially
  846. 34:00after Java 8 with the default methods.
  847. 34:03So,
  848. 34:04yeah. So, basically this is the
  849. 34:05difference like being very brief. And do
  850. 34:07you know marker interface?
  851. 34:10Yeah, marker interface is an empty
  852. 34:12interface we can say. So, that is used
  853. 34:14to indicate some special behavior to JVM
  854. 34:17or framework.
  855. 34:19So, for example, like serializable tells
  856. 34:22JVM that the object can be serialized.
  857. 34:24So, it is just like empty interface we
  858. 34:27can say. But yeah, that is for the
  859. 34:28notation like
  860. 34:30how the work of any like annotation we
  861. 34:33are going to use. Okay. So, in SQL, can
  862. 34:35you tell me what is the difference
  863. 34:37between SQL and NoSQL databases? Yeah.
  864. 34:40So, SQL databases are like relational
  865. 34:43databases that store data in structured
  866. 34:47tables with rows and columns. So, they
  867. 34:49follow a fixed schema meaning that the
  868. 34:52structure of the data must be defined
  869. 34:55before inserting data.
  870. 34:57So, that is what is that and examples
  871. 34:59like we have MySQL, PostgreSQL, Oracle.
  872. 35:02So, all these are the SQLs. Okay?
  873. 35:05So, like they are best suited for the
  874. 35:07applications where data consistency and
  875. 35:10relationships are important like banking
  876. 35:12system and all. Okay? On the other hand,
  877. 35:14NoSQL databases are non-relational and
  878. 35:17provide flexible schemas. So, they can
  879. 35:20store data in formats like key-value and
  880. 35:23document, column or paragraph. So, in
  881. 35:26this case examples we have like MongoDB,
  882. 35:29Cassandra, Redis. So, all these are
  883. 35:31examples of it. So, [snorts] they are
  884. 35:33designed for scalability and handling
  885. 35:35large volumes of
  886. 35:38unstructured or semi-structured data.
  887. 35:40So, that makes them suitable for the
  888. 35:41real-time application and big data
  889. 35:43system. So,
  890. 35:44So, that's the difference between these
  891. 35:46two. Do you know what is normalization
  892. 35:48and denormalization
  893. 35:50and why we use it? Yeah. So,
  894. 35:52normalization is the process of
  895. 35:54organizing the data in a database to
  896. 35:57reduce the redundancy and improve the
  897. 35:59data like integrity. And it involves the
  898. 36:03dividing large table into smaller ones
  899. 36:07and defining relations between them.
  900. 36:09Okay? So, this basically ensures that
  901. 36:12the data is stored only once and avoids
  902. 36:15duplication. So, that's what is the
  903. 36:17normalization. So, basically we have
  904. 36:18there are different types of normal
  905. 36:20forms like I think 1NF, 2NF, 3NF and
  906. 36:23all. So, each with have the specific
  907. 36:26rules. For example, 1NF removes the
  908. 36:28repeating groups. Okay? And 2NF like
  909. 36:31removes the particular dependencies and
  910. 36:333NF removes the like transitive
  911. 36:35dependencies. Okay? So, yeah. So, that
  912. 36:37is what is the normalization and like
  913. 36:39its various forms. And the
  914. 36:41denormalization?
  915. 36:42>> Yeah, again denormalization is a process
  916. 36:44of combining tables to reduce the number
  917. 36:47of joins and
  918. 36:48improve the query performance. Okay? So,
  919. 36:51it intentionally introduces the
  920. 36:54redundancy into the database for the
  921. 36:56faster read operations. So, that is what
  922. 36:59is the denormalization. So, it is
  923. 37:01commonly used in reporting system or
  924. 37:05data warehouse where the read operation
  925. 37:08is kind of more important than the write
  926. 37:10efficiency. Yeah. So, however, it like
  927. 37:11it can lead to data inconsistency if not
  928. 37:14managed properly, but yeah, that is what
  929. 37:16is the purpose of denormalization. And
  930. 37:18what is indexing and why it is used?
  931. 37:21>> Yeah, indexing is used to improve the
  932. 37:23like speed of the data retrieval in a
  933. 37:26databases. So, it works like an index in
  934. 37:30a book we can say. So, like it allows
  935. 37:33the database to quickly locate rows
  936. 37:36without scanning the entire table. So,
  937. 37:38that is what is the indexing.
  938. 37:40So, like however, like indexes
  939. 37:44like come with a trade-off. So, like
  940. 37:46while they improve the read performance,
  941. 37:48they can also slow down the write
  942. 37:50operations because we need more memory
  943. 37:52to I mean convert the whole database
  944. 37:56like into the form so that the indexing
  945. 37:59can be applied on top of that. Any
  946. 38:01select query we are writing. So, it
  947. 38:02basically it will like kind of divide
  948. 38:04the whole like we have dictionary like
  949. 38:07right? So, if suppose we have to see any
  950. 38:10search with the A, we can directly go
  951. 38:12with
  952. 38:13a like from which page number to which
  953. 38:14to page number A is there. So, and which
  954. 38:17page number to which page number B is
  955. 38:19there. So, similarly in case of indexing
  956. 38:21also, we have the similar concept like
  957. 38:25and but because of that, we have we need
  958. 38:27extra memory. So, that is why the write
  959. 38:29up becomes the bit bit slower, but yeah,
  960. 38:32the read be be become the faster. And
  961. 38:33what is the difference between delete,
  962. 38:35truncate and drop? Yeah. So, delete
  963. 38:37removes the specific rows based on the
  964. 38:40condition and it can be rolled back. So,
  965. 38:42that is the delete. And truncate
  966. 38:44basically removes all rows from the
  967. 38:46table quickly and can't be rolled back.
  968. 38:48Okay?
  969. 38:49And drop basically completely deletes
  970. 38:51the table structure along with its data.
  971. 38:53So, that is the drop.
  972. 38:55So, that's the major difference between
  973. 38:56these three.
  974. 38:57>> Do you know what is sharding? Yeah,
  975. 38:58sharding is a technique used to like
  976. 39:02distribute data across the multiple
  977. 39:04servers. So, each shard like contains a
  978. 39:07sub subset of data. So, this ultimately
  979. 39:11improves the scalability and performance
  980. 39:13and especially in the larger scale
  981. 39:14system where single database cannot be
  982. 39:17handled like or cannot handle all the
  983. 39:19load. So, basically we we divide the
  984. 39:21whole load to different different
  985. 39:23servers. Can you tell me if you have
  986. 39:25given the scenario to choose SQL or
  987. 39:28NoSQL?
  988. 39:29So, when would you choose SQL and when
  989. 39:33would you choose NoSQL? Yeah. So, SQL is
  990. 39:35preferred when data is a structured and
  991. 39:37relationships are important such as like
  992. 39:40in functional or transactional uh
  993. 39:43systems. So, NoSQL is preferred when
  994. 39:46they're dealing with the large-scale
  995. 39:47flexible and rapidly changing data. So,
  996. 39:49for example, uh we have the real-time
  997. 39:51analytics or social media applications.
  998. 39:54So, in that case, no no SQL will be more
  999. 39:56preferred.

About this transcript

This page contains the full transcript of Deloitte Interview | Java 8 | Spring Boot | Microservices | Cloud | Docker | SQL | NoSQL | 2–7 Years by Insights Instructor, generated from the public captions YouTube serves with the video. The transcript has 6,017 words across 999 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.