YouTube2Text

Java Spring Boot 10+ Yrs Interview Experience [Lead Developer] — Transcript

by GenZ Career · 5,724 words · 946 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Hey guys, today we have Sep and he is
  2. 0:02having total 10 plus year of experience
  3. 0:04in Java, Spring Boot and microservices
  4. 0:05domain and those who want to give same
  5. 0:07free mock interview, please fill out the
  6. 0:09form below in the description. So now
  7. 0:10let's get started. Hey hello Sep, how
  8. 0:12are you?
  9. 0:14>> Hi. Hi Ali, good afternoon. I'm good.
  10. 0:15How are you?
  11. 0:16>> Yes, I'm also good. Shall we start?
  12. 0:18>> Yes. Yes.
  13. 0:19>> Okay. Okay. So can you please introduce
  14. 0:21yourself? It seems you are very excited,
  15. 0:23right? [laughter]
  16. 0:24>> Excited and bit nervous as well but
  17. 0:26yeah. [gasps]
  18. 0:26>> Okay. So can you please introduce
  19. 0:28yourself and your recent project in
  20. 0:30brief?
  21. 0:32>> Yeah. [clears throat]
  22. 0:34Uh so uh basically I have around 10
  23. 0:36place of uh working experience uh with
  24. 0:39mainly into Java and Spring Boot and uh
  25. 0:42uh microservices. Uh present my role is
  26. 0:45uh principal software engineer in
  27. 0:47whichever the organization I'm working
  28. 0:48on. Uh my recent uh project is one of
  29. 0:53the uh project uh in Texas and east in
  30. 0:57uh uh uh US where they are supporting
  31. 0:59some electric electricity and gas
  32. 1:02services uh
  33. 1:03>> uh to the uh uh people who are living in
  34. 1:06those multiple states based on the zip
  35. 1:08codes, utilities uh uh we are providing
  36. 1:11some offers, building uh everything uh
  37. 1:14uh to them. That is the recent project
  38. 1:16what I have worked on. While coming to
  39. 1:17the very latest things, recently we have
  40. 1:20started uh uh migrating to Spring Boot 3
  41. 1:23and uh Java 21 to some of the uh
  42. 1:26projects. We uh yeah it's it's in
  43. 1:29challenges that you are facing uh in
  44. 1:30migration. Uh the thing is it it is
  45. 1:34giving all the dependencies which
  46. 1:36supports by spring boot dependency like
  47. 1:383 through 3x versions and uh we are uh
  48. 1:43pointing it to Java 20 till that is good
  49. 1:46but uh there are lot of things uh we are
  50. 1:49uh experiencing during a lot of things
  51. 1:52are getting failed uh uh when we are
  52. 1:54running the mayan build and when we are
  53. 1:55running the application and during Mayan
  54. 1:57build we are getting a lot of compil
  55. 1:59compilation issues mainly with respect
  56. 2:00to uh what we call Java X and the
  57. 2:03Jakarta uh imports are being changed and
  58. 2:06uh uh another thing is uh JPA repository
  59. 2:09things are getting failed because of the
  60. 2:12syntactical errors uh with the respect
  61. 2:14to the different hibernate versions. uh
  62. 2:17some some of the uh syntaxes which were
  63. 2:21not uh present in the 21 still we are
  64. 2:24using either it from 11 or 17 or 8 it's
  65. 2:27telling that you have to override this
  66. 2:29and you have to import new imports and
  67. 2:32uh removing the old one
  68. 2:33>> and also have you migrated Java X to
  69. 2:35Jakarta or it was already migrated
  70. 2:38>> no we are migrating to Java X to Jakarta
  71. 2:41>> okay got it let's say you have a
  72. 2:45monolithic application with no test and
  73. 2:49poor documentation, right? So, how would
  74. 2:51you plan the migration to microservices?
  75. 2:57>> Okay. M
  76. 2:58>> uh so
  77. 3:00basically when as you told when we don't
  78. 3:03have any proper test and poor uh this
  79. 3:06code quality generally what I'll be
  80. 3:08doing is things like first I'll start
  81. 3:09with uh uh starting some uh critical
  82. 3:12unit and integration test for the most
  83. 3:14of the uh importance and uh risky parts
  84. 3:17of the application like what are the
  85. 3:19main APIs we have
  86. 3:20>> uh to ensure before migrating those are
  87. 3:23the API should be uh stable and uh
  88. 3:25working as expected because because most
  89. 3:27of API whatever the biggest APIs are
  90. 3:30there like small small APIs and which
  91. 3:32has less functionality less dependency
  92. 3:34on the production and which will giving
  93. 3:36the response with less business logic
  94. 3:38and all that will be taken care of in
  95. 3:40the next level mainly focusing on the uh
  96. 3:42major APIs uh and also uh gradually
  97. 3:46we'll refactor the code in small chunks
  98. 3:48to improve the uh readability and
  99. 3:50maintainability without breaking the
  100. 3:52existing functional that is also one of
  101. 3:54the uh main thing uh and also if there
  102. 3:57are we don't have any uh integrating
  103. 4:00with the sonar QVs to do that as well to
  104. 4:02prevent lot of the uh major uh minor
  105. 4:06critical uh and all these uh uh bugs.
  106. 4:10>> Okay. Yes. Yes. That's nice. Okay. So
  107. 4:13can you tell me how would you implement
  108. 4:14soft deletes?
  109. 4:16>> Swap delete or soft delete?
  110. 4:17>> Soft sof.
  111. 4:19>> Okay.
  112. 4:20>> Yep.
  113. 4:21>> Uh
  114. 4:23so basically soft delete it's like uh
  115. 4:25removing the record it from the
  116. 4:27uh database or storage uh usually it's
  117. 4:30setting uh flag by is disabled is equal
  118. 4:33is deleted is equals to true if I'm not
  119. 4:35wrong
  120. 4:36>> uh what happens in that case is that uh
  121. 4:38I'll write a boolean field is deleted is
  122. 4:41equals to uh true in the entity and I'll
  123. 4:44update it while uh deleting and modifies
  124. 4:47the query to uh filter out some soft
  125. 4:50deleted records
  126. 4:53>> and also what happens in this case is
  127. 4:55like uh M and this is uh
  128. 4:58>> what's the difference between soft
  129. 4:59delete and hard delete?
  130. 5:01>> Soft delete and uh hard delete.
  131. 5:03>> Mhm.
  132. 5:04>> Okay.
  133. 5:05So as I told uh earlier uh this is used
  134. 5:11to delete and make a copy and it is used
  135. 5:13for data retrieving and hard delete I
  136. 5:16think it will be difficult for us to
  137. 5:18retrieve the data in case of uh copying
  138. 5:21or something like that.
  139. 5:22>> Mhm. Yeah. Yeah. That's correct. Soft
  140. 5:24delete means we are not deleting it. We
  141. 5:26are just hiding it. But it is somewhere
  142. 5:28in the database.
  143. 5:30>> Database. Correct. Correct.
  144. 5:31>> Mhm. But
  145. 5:31>> and soft delete that's what uh yeah it
  146. 5:34it is used for data retrieval as well.
  147. 5:36Soft delete what I mean to say.
  148. 5:37>> Okay. Hey guys, I want to share
  149. 5:39something important with you. Actually
  150. 5:40Sundep prepared from our interview
  151. 5:42preparation kit and cracked multiple
  152. 5:44interviews. We have also referred him to
  153. 5:46the multiple companies. So let me tell
  154. 5:48you this interview preparation kit has
  155. 5:49four main parts. First is complete
  156. 5:51interview preparation material. It is a
  157. 5:53step-by-step material made by me expert
  158. 5:55and MNC's interviews. 99% of the
  159. 5:57questions asked in interviews are
  160. 5:58covered in it. Second is two real
  161. 6:00enterprise client projects code and
  162. 6:01video recorded sessions are there and
  163. 6:03you can add this in your resume. Third
  164. 6:05is lifetime chat support. Here you can
  165. 6:07ask your doubts any time. Fourth is
  166. 6:09referral support. Here we help you get
  167. 6:10referred to the top MNC's. So basically
  168. 6:13the material is organized as per your
  169. 6:14experience level and covers Java, Spring
  170. 6:16Boot, Spring Security, Spring Data, JPM,
  171. 6:19microservices, Kafka, Maven get coding
  172. 6:21questions, stream API coding questions
  173. 6:22and many more. You can buy just the
  174. 6:24complete interview preparation material
  175. 6:25or the full kit with project supports
  176. 6:27and referrals. I have added the links in
  177. 6:29the description below. So now moving to
  178. 6:31our interview and guys before moving to
  179. 6:33our interview since sep is here so we
  180. 6:35can ask about uh the review of uh that
  181. 6:38kit. So SEP uh could you please go
  182. 6:40ahead?
  183. 6:40>> Uh yeah. So uh that kit whatever
  184. 6:44whichever the kit I have purchase it's
  185. 6:46uh very very helpful.
  186. 6:47>> Okay.
  187. 6:48>> Even uh I could see very uh small small
  188. 6:51things and small small concepts in
  189. 6:53detail with explanation
  190. 6:55>> uh that how uh it will helpful in
  191. 6:57writing or any interview preparation and
  192. 7:00while implementing any of the logic
  193. 7:01which improves the performance
  194. 7:03[clears throat] and all and also it
  195. 7:04helped me in cracking more number of uh
  196. 7:07interviews as well. Most of the
  197. 7:08questions as you are telling in uh every
  198. 7:10video like yeah most of the questions
  199. 7:12are being asked uh that was yeah helpful
  200. 7:15very very helpful even I was regularly
  201. 7:17following your uh uh uh this interview
  202. 7:20videos as well.
  203. 7:21>> So okay nice
  204. 7:22>> yeah I suggest if anyone wants to crack
  205. 7:24the interview it's better to buy a kit
  206. 7:27and watch your interview videos that
  207. 7:29would be very very helpful. Okay buddy.
  208. 7:32Yeah, thank you so much. Now
  209. 7:34>> thanks. Thanks man.
  210. 7:35>> Let's move to our interview. How would
  211. 7:38you prevent common vulnerabilities in a
  212. 7:40rest API? Common vulnerabilities means
  213. 7:43like SQL injection, CSRF, XSS.
  214. 7:47>> Okay.
  215. 7:48>> Mhm.
  216. 7:49>> In this case what we can do? Okay. uh
  217. 7:52before uh entering the uh control to the
  218. 7:56controller, we can write some
  219. 7:58>> filters and some regular expressions in
  220. 8:01our code. [snorts] If any of the request
  221. 8:04is uh coming to a filter, if it matches
  222. 8:07that regular expression either as you
  223. 8:09told uh SQL injection or XSS uh uh this
  224. 8:13one cross scripting and all. So we we
  225. 8:17are matching if uh the request has that
  226. 8:19regular expression and we are uh not
  227. 8:21sending the control to control and
  228. 8:23redirecting to some either uh login page
  229. 8:25or something like that.
  230. 8:28>> Yeah. Yeah. And also instead of some uh
  231. 8:31exposing sensitive data through uh
  232. 8:33improper error message and unsecure
  233. 8:35endpoints uh
  234. 8:39yeah something
  235. 8:41>> and we could use prepared statements
  236. 8:43input validation CSR tokens input
  237. 8:45validation headers. Yes.
  238. 8:47>> Yes. Yes. Yes. Headers as well. Yeah.
  239. 8:49>> Okay. So in your current project how you
  240. 8:51guys are rotating secrets?
  241. 8:53>> Okay. So we have different types of uh
  242. 8:56uh secrets. So basically uh different uh
  243. 9:00projects are using different types of uh
  244. 9:01secrets. So in in this case I'm
  245. 9:04considering secrets. It's not about only
  246. 9:06the secret key. It can be any uh uh uh
  247. 9:10what we call database passwords or uh
  248. 9:12third party API passwords everything we
  249. 9:13are considering it as a uh secrets. Uh
  250. 9:16database things we are handling it
  251. 9:18through the console.
  252. 9:19>> Mhm.
  253. 9:20>> Okay. Uh and also if related to any AWS
  254. 9:25projects uh uh SQL sorry uh secrets are
  255. 9:28automatically rotated on a uh
  256. 9:31scheduleuler configured in AWS and also
  257. 9:34other thing uh we are also having uh
  258. 9:37monitoring or alerting in places to
  259. 9:39detect any unauthorized access or
  260. 9:41failure in uh uh secrets retrieval. And
  261. 9:44in AWS we will be using some secret
  262. 9:46managers to secure uh store and some
  263. 9:50manage secrets like database
  264. 9:51credentials, API keys, uh tokens uh as I
  265. 9:55told any if you are validating through
  266. 9:56any third party API for that usernames
  267. 9:58and password something like that.
  268. 10:00>> Correct. Correct. Okay. So can you
  269. 10:03please tell me how would you design a
  270. 10:05system to handle 100x traffic spikes?
  271. 10:08>> Okay.
  272. 10:09>> Mhm. So first of all okay based on the
  273. 10:14complete design I'll decide okay by
  274. 10:18default I'll make it as a micros service
  275. 10:20that's for sure
  276. 10:21>> so and after that I'll decide how many
  277. 10:24number of uh services it required
  278. 10:27instead of uh uh dividing into main
  279. 10:30let's say if uh complete application
  280. 10:32required three I cannot make it to seven
  281. 10:34because of some cost cutting issues uh
  282. 10:37maintenance and all uh because if
  283. 10:39everything is dependent on each and
  284. 10:40everything. So in order to avoid that
  285. 10:42problem, I'll make sure that only
  286. 10:44required number of services it should
  287. 10:46have. Uh and also I'll make it most of
  288. 10:50the things I'll make it as stateless
  289. 10:52components. Stateless components so we
  290. 10:54can use uh uh horizontally by adding
  291. 10:56more uh instage during spikes.
  292. 10:59>> Mhm.
  293. 10:59>> And we'll use load balances as well.
  294. 11:02>> Okay. And also we'll be using some uh
  295. 11:05caching techniques to each and every
  296. 11:07time to make the call to the backend
  297. 11:09service which will reduce the traffic
  298. 11:12like we can use radius cachy and store
  299. 11:13it in our uh things and we can use uh
  300. 11:16wherever uh we required.
  301. 11:18>> That's correct. Okay. So how how would
  302. 11:20you optimize JVM startup time? JVM will
  303. 11:24use uh quick start
  304. 11:29to reduce the time spent on uh uh the
  305. 11:33compiler during uh startup
  306. 11:35>> means I didn't get you
  307. 11:39>> uh
  308. 11:42what we call that uh how to explain
  309. 11:46>> have you heard about grow VM?
  310. 11:51No.
  311. 11:53>> Okay. Um
  312. 11:54>> I while even I have saw this uh I'll
  313. 11:59tell basically so I think in your
  314. 12:02interviews only I've start how to reduce
  315. 12:04the time whenever we run any springwood
  316. 12:07application if I'm not wrong from that I
  317. 12:09got to know this while reading I got to
  318. 12:11know this as well. So only one thing I
  319. 12:15know is like uh x - x start uh while
  320. 12:19running the uh jit compile or something
  321. 12:22like that.
  322. 12:22>> Okay. Yeah, that may be the answer. I'm
  323. 12:25not aware
  324. 12:25>> another one.
  325. 12:27>> Maybe another use uh yeah maybe another
  326. 12:29way but we could use grav native image
  327. 12:32for fast startup class data sharing to
  328. 12:35use class meta data right AOT uh
  329. 12:38compilation. [snorts]
  330. 12:41>> Okay. Um do you know about object
  331. 12:44pooling?
  332. 12:45>> Yes.
  333. 12:46>> Okay. Please go ahead.
  334. 12:47>> Uh what we call what basically so it's a
  335. 12:50technique where uh we'll create a pool
  336. 12:53of uh what we call reusable objects. So
  337. 12:56instead of creating and destroying uh
  338. 12:59them repeatedly.
  339. 13:01uh what is the main use of this uh
  340. 13:03object pooling is like uh it will
  341. 13:05improve the uh performance by creating
  342. 13:08the overhead object creation and then uh
  343. 13:11garbage collection. M
  344. 13:13>> so basically it's like yeah we uh object
  345. 13:17pooling is like connection pooling I
  346. 13:19think most of the most of them we have
  347. 13:21use heard the call as uh connection pool
  348. 13:24while creating the database uh
  349. 13:26connections similar way while creating
  350. 13:28multiple uh reusable objects
  351. 13:31>> yep yep that's correct um so sep can you
  352. 13:34please explain JVM architecture like the
  353. 13:37role of class loader runtime data areas
  354. 13:40and execution engine.
  355. 13:45>> Okay.
  356. 13:45>> Mhm.
  357. 13:46>> So, one thing.
  358. 13:51Okay. Uh so, basically uh this JVM
  359. 13:55architecture is several uh is made up of
  360. 13:57several components which is used to uh
  361. 14:00which all together uh which is used to
  362. 14:03run the Java program. That is the main
  363. 14:04thing. Uh as you asked for the class
  364. 14:06loader uh thing uh uh it loads the class
  365. 14:09files into our uh JVM memory uh we have
  366. 14:13uh uh what we call different types of uh
  367. 14:16uh hierarchy like uh uh bootstrap uh
  368. 14:19extensions uh that loads core java
  369. 14:22classes extens extensions and uh
  370. 14:24applications classes respectively. uh if
  371. 14:27I'm not wrong uh I think uh correct me
  372. 14:30if if I'm not if I'm uh wrong I think
  373. 14:32class loader is responsible for uh uh
  374. 14:35what we call assigning default values to
  375. 14:38all the different types of uh data types
  376. 14:40if if I'm not wrong uh that is one thing
  377. 14:44>> and also as we know different types of
  378. 14:47objects like heap stack uh uh string
  379. 14:49constant pool and all method area where
  380. 14:51we'll have uh
  381. 14:53ob
  382. 14:55memory space allocated for uh uh
  383. 14:57constants and static variables. Heap for
  384. 14:59all objects. Uh and uh we have uh
  385. 15:03>> what's the difference program and heap
  386. 15:05memory?
  387. 15:10>> What is the difference between
  388. 15:11>> stack memory and heap memory?
  389. 15:16>> Okay. He heap is used to store all the
  390. 15:20objects basically where all the objects
  391. 15:22is stored uh and also uh when any
  392. 15:26objects is created in heap memory it is
  393. 15:29uh uh managed by uh garbage collectors
  394. 15:32and uh it can be uh shared across all
  395. 15:35the threads. That is one thing. While
  396. 15:37coming to uh stack uh stack memory uh
  397. 15:41mainly it's used to store some local
  398. 15:44variables and uh references. Mhm.
  399. 15:47>> Uh in this case uh each thread will have
  400. 15:50its uh own stack or something like that.
  401. 15:53>> And also stack memory is uh limited in
  402. 15:56size
  403. 15:58which heap has some uh larger memory
  404. 16:00allocation based on the dynamic memory
  405. 16:03allocation.
  406. 16:04>> Correct. Correct. Okay. Can you explain
  407. 16:07the Java's thread life cycle and also uh
  408. 16:09the difference between blocked waiting
  409. 16:11and time waiting states?
  410. 16:15Java thread life cycle.
  411. 16:17>> Yes. Yes.
  412. 16:18>> Yeah. So we'll have new runnable running
  413. 16:21blocked and uh
  414. 16:22>> uh dead or terminated. Uh basically
  415. 16:27uh when a thread enters into that uh it
  416. 16:30will be in uh new state which uh that
  417. 16:32means that thread is not yet started. uh
  418. 16:35after calling the start method uh that
  419. 16:38thread will be in uh uh runnable state
  420. 16:40and I think it will be waiting for the
  421. 16:42CPU approval to CPU time to run uh to
  422. 16:45run the job. Uh and while when it is in
  423. 16:50running state uh uh I think it will pick
  424. 16:53some uh scheduulers and the thread it
  425. 16:55and it starts executing. uh whenever we
  426. 16:59write uh any waiting or asynchronous
  427. 17:02calls it will be in blocked or waiting
  428. 17:04state and terminated when thread
  429. 17:06finishes its complete task it is in
  430. 17:08terminated.
  431. 17:09>> Mhm. Yes. Yes. That's correct. Okay. So
  432. 17:13seping
  433. 17:19>> log striping. No.
  434. 17:20>> Mhm. Okay. So concurrent hashmap uses it
  435. 17:23[snorts] internally. Do you know?
  436. 17:26>> Yes.
  437. 17:28Yeah, please go ahead.
  438. 17:30>> Yeah, so [clears throat]
  439. 17:33I think uh this concurrent hashmap will
  440. 17:34come into the picture when uh I guess
  441. 17:36when we are reading and making uh uh
  442. 17:39some changes to the map, concurrent
  443. 17:40exception will occur. In order to avoid
  444. 17:42that problem, we'll be using this uh uh
  445. 17:45concurrent hashmap.
  446. 17:46>> Mhm.
  447. 17:46>> Okay. uh what we'll do is like uh
  448. 17:49internal uh it will divide the uh data
  449. 17:52into multiple segment and uh uh seg
  450. 17:56segments and strikes or stripes if I'm
  451. 17:58not wrong. uh uh and each one will have
  452. 18:00its own lock to perform some uh uh
  453. 18:04operations without blocking each other.
  454. 18:06>> Mhm.
  455. 18:07>> And also this is used to help the uh
  456. 18:10what we call performance by uh uh
  457. 18:13locking and uh locking only the specific
  458. 18:17uh grain uh object uh instead of
  459. 18:20completely blocking the entire map. What
  460. 18:22happens in this case is like threats can
  461. 18:24operate on different parts of the map
  462. 18:26simultaneously. M
  463. 18:28>> uh redundant uh uh bottleneck uh we can
  464. 18:32solve that uh issue.
  465. 18:34>> Okay. Yep. Yep. That's correct. Uh so
  466. 18:37sep uh tell me um let's say if there are
  467. 18:40some concurrency issues in the hashmap,
  468. 18:42we could use concurrent hashmap, right?
  469. 18:44But if there are some issues in hashet,
  470. 18:46so what would be use in used?
  471. 18:53So as we know [snorts] hashmap is not uh
  472. 18:57thread safe uh and uh multiple threads
  473. 19:00is uh uh modifying it concurrently. So
  474. 19:05it can throw some uh what do you call
  475. 19:07concurrent modification exception
  476. 19:09>> the same thing is I mean there in the
  477. 19:11hash thread right?
  478. 19:13>> Yes.
  479. 19:13>> So what's the alternative in the hash
  480. 19:16then?
  481. 19:19printing what's alternating hash set
  482. 19:22>> if we want to use the thread safe hash
  483. 19:25set. So
  484. 19:27>> uh what would you use
  485. 19:31>> think concurrent hashmaps dot new hash
  486. 19:35set or something new key set if I'm not
  487. 19:38wrong. No, no.
  488. 19:40>> Oh,
  489. 19:41>> yeah. All obviously uh by using
  490. 19:44concurrent hashmap we can uh work with
  491. 19:46the set as well.
  492. 19:48>> We can work with keys or values, right?
  493. 19:51And sorry keys and make synchronizes.
  494. 19:54>> Yeah. Yeah. Synchroniz
  495. 19:55>> collections don't synchronize
  496. 19:56>> collections. Ah okay okay. Actually yeah
  497. 20:00concurrent
  498. 20:01>> and thread safe.
  499. 20:03>> Yes. Yes. Yes. Actually yeah uh there
  500. 20:06were two ways uh I guess. One is uh uh
  501. 20:09concurrent hashmap dot new case set uh
  502. 20:12which provides a concurrent set uh by a
  503. 20:15concurrent hashmap. Other one is like
  504. 20:16yeah collections dots synchronize set.
  505. 20:19>> Yep. Yep. Got it.
  506. 20:20>> But what's the drawback of using
  507. 20:21collections synchronized map set?
  508. 20:30What is the drawback of using
  509. 20:32>> these collections dots synchronize map
  510. 20:34synchronize set synchronize list?
  511. 20:40I think
  512. 20:44maybe
  513. 20:45it will reduce some performance because
  514. 20:48of some high occurrences.
  515. 20:52>> No.
  516. 20:52>> And also no because of any locking
  517. 20:55system internally.
  518. 20:57>> Yeah. Yeah. Because of locking system. M
  519. 20:59yes
  520. 20:59>> it locks the entire map or set or this
  521. 21:02[clears throat]
  522. 21:03>> yes
  523. 21:03>> don't work it doesn't work uh based on
  524. 21:06the segments right
  525. 21:08>> segments or stripes what's happening in
  526. 21:10the main concurrent hashmap
  527. 21:11>> yep y
  528. 21:12>> yeah yes yes complete blocking system
  529. 21:15>> okay so sep
  530. 21:17migrated to Java 21 or migrating to Java
  531. 21:2021 uh do you know the concept of virtual
  532. 21:23threads in Java
  533. 21:29virtual threats.
  534. 21:31>> Uh we call it project loom
  535. 21:35also.
  536. 21:38>> Yeah. Yes, I heard this. Yeah. uh it's
  537. 21:41like uh lightweight threads uh managed
  538. 21:44by I guess uh Java runtime rather than
  539. 21:48the OS the main thing
  540. 21:51>> and also
  541. 21:53uh they are used to write uh concurrent
  542. 21:55code much simpler uh uh and also we can
  543. 22:01use the same thread uh uh per model but
  544. 22:05uh which will which will make the better
  545. 22:07uh scalability. [clears throat]
  546. 22:09>> Yep. Yep. And
  547. 22:12>> virtual threads are lightweight threads
  548. 22:13managed by JVM instead of us.
  549. 22:16>> They allow handling thousands of
  550. 22:17concurrent task efficiently.
  551. 22:20>> Yeah, I think basically they they'll be
  552. 22:22calling it as game changer for
  553. 22:24concurrency in Java.
  554. 22:25>> Yes, even
  555. 22:27>> in 21
  556. 22:29since uh since you said you are
  557. 22:31migrating to Java 21. So uh questions
  558. 22:34from Java 21 could be asked to be
  559. 22:38prepared.
  560. 22:38>> Okay.
  561. 22:39>> Yes.
  562. 22:40Okay.
  563. 22:41>> Y and how does springs async annotation
  564. 22:45work under the hood or behind the scene?
  565. 22:50>> Okay. M
  566. 22:52>> uh
  567. 22:53especially in case of uh asynchronous
  568. 22:56calls whenever we write any uh method
  569. 22:59with asynchronous it's annotated within
  570. 23:02asynchronous
  571. 23:03>> uh I think whenever we run the
  572. 23:04application that async method will have
  573. 23:07a separate uh thread to uh finish its
  574. 23:10task
  575. 23:11>> uh and also uh whenever it's uh uh the
  576. 23:17thread submits the method to the call uh
  577. 23:20what task task executor uh
  578. 23:22>> uh which is managed by the thread pool
  579. 23:25>> and also
  580. 23:27uh it will uh enable some non-blocking
  581. 23:29behavior as well.
  582. 23:31>> Mhm.
  583. 23:33>> Uh simple asynchronous task task
  584. 23:35executor something like that.
  585. 23:36>> It uses spring
  586. 23:39>> and run methods in a separate thread
  587. 23:40pool.
  588. 23:41>> Correct. Correct. Correct.
  589. 23:43>> Correct. Have you worked with spring
  590. 23:45weblex? Web flux sorry
  591. 23:51>> uh no
  592. 23:52>> no okay basically web flux supports
  593. 23:55non-blocking reactive programming
  594. 23:58right
  595. 23:58>> okay okay
  596. 24:02uh moving ahead
  597. 24:06uh do you know about event listener
  598. 24:08annotation
  599. 24:13yes
  600. 24:15please go ahead
  601. 24:16Yeah. So [clears throat] uh this is uh
  602. 24:19as as discussed with the asynchronous.
  603. 24:22So whenever uh we'll be using the same
  604. 24:24as similar way of annotation like event
  605. 24:27listener
  606. 24:28>> uh spring automatically uh calls that
  607. 24:31method uh when we annotate uh at the
  608. 24:33rate event listener uh
  609. 24:34>> uh which matches with that uh specific
  610. 24:36uh event type
  611. 24:38>> and also uh uh this uh removes this
  612. 24:42removes the need of uh uh implement
  613. 24:44application listener explicitly
  614. 24:47>> uh which is uh uh which makes the code
  615. 24:50more readable and uh easier to maintain.
  616. 24:55>> Okay.
  617. 24:55>> And also it supports features like uh uh
  618. 24:59conditional event and asynchronous
  619. 25:01processing
  620. 25:02>> uh fastdriven uh uh responses. Event
  621. 25:06driven respon not fast driven event
  622. 25:08driven responses.
  623. 25:09>> Yep. Yep. That's correct. Okay. So uh
  624. 25:12sep when would you use retryable
  625. 25:15annotation versus manual retry logic?
  626. 25:23retryable and then uh manual retry.
  627. 25:26>> Mhm.
  628. 25:29>> Retriable
  629. 25:31uh we'll be using when uh any method on
  630. 25:36failure basis uh like maximum number of
  631. 25:40times it's uh it want to reattempt or
  632. 25:43recall uh any exceptions. So you don't
  633. 25:46want to uh write your code for yourself
  634. 25:50that is I think retraable manual retry
  635. 25:52logic is like uh write your uh own loops
  636. 25:56or recursive calls to retry operations.
  637. 26:01>> Yep. Yep. That's correct. Okay. So how
  638. 26:05would you implement distributed locking
  639. 26:07in Spring Boot?
  640. 26:15distributed. Okay. Uh
  641. 26:19distributed or the basic uh
  642. 26:21>> distributed locking in
  643. 26:24>> distributed locking in in
  644. 26:27>> Spring. Okay. Uh I think distributed is
  645. 26:33uh used when we have uh
  646. 26:36multiple instances of our applications
  647. 26:39like uh yeah microservices uh because uh
  648. 26:44uh it it needs to coordinate access to
  649. 26:47shared sources across the all the
  650. 26:49services and also for distributed uh uh
  651. 26:54locking we'll be using uh uh uh radius
  652. 26:57and zookeep keeper uh to create the
  653. 26:59logs.
  654. 27:00>> Uh Kafka Zookeeper
  655. 27:03>> uh only one instance uh can perform some
  656. 27:06critical operations uh at a time.
  657. 27:09>> Yep. Yep. It can also be implemented by
  658. 27:12using radius if you have used
  659. 27:14>> Yes. Radius
  660. 27:15>> or database or
  661. 27:16>> radius or zoo. Mhm. Radius or zookeeper.
  662. 27:20Yes.
  663. 27:20>> Yep. Yep. Okay. Okay. So in
  664. 27:22microservices, have you heard about ACL
  665. 27:24pattern? Anti-corruption layer pattern?
  666. 27:29>> ACL or anti-corruption. Yes.
  667. 27:32>> Yeah.
  668. 27:32>> ACL. Yeah. Abbreviation ACL
  669. 27:35anti-corruption uh pattern. Uh it's same
  670. 27:38like I think if I'm not wrong, it's one
  671. 27:40of the uh design patterns what we have
  672. 27:42some architecture sorry orchestrators
  673. 27:44and other design patterns uh during in
  674. 27:46microservices implementation. uh what
  675. 27:49basically this ACL is used to protect
  676. 27:51our uh systems being from being tightly
  677. 27:54coupled uh to external systems or uh
  678. 27:58legacy code.
  679. 27:59>> Uh and also it acts like a uh translator
  680. 28:02between system and the external systems
  681. 28:06uh converting our all the data and calls
  682. 28:09uh uh unaffected by the external
  683. 28:11changes. M
  684. 28:13>> what we call it is used to maintain some
  685. 28:16integrity and uh uh what we call uh
  686. 28:20inconsistency of any poorly designed
  687. 28:22architectures any in any of the service.
  688. 28:26>> Yeah.
  689. 28:28>> That's correct. Um what is the sidecar
  690. 28:31pattern? Have you heard about sidecar
  691. 28:33pattern?
  692. 28:36>> No.
  693. 28:37>> Sidecar? No.
  694. 28:38>> Okay. No.
  695. 28:39>> Yeah. [laughter] It runs a helper
  696. 28:41component alongside the main service uh
  697. 28:44in service mesh right handle networking
  698. 28:46logging security and monitoring without
  699. 28:48modifying the application code.
  700. 28:51>> Okay.
  701. 28:51>> It's like um we do logging in spring
  702. 28:54boot use a something like that.
  703. 28:58>> Yeah, I got it. Like yeah.
  704. 29:00>> Mhm.
  705. 29:00>> Any Yeah. AOP basically as you said uh
  706. 29:03any logging information any validations
  707. 29:06[clears throat] before uh uh entering
  708. 29:08into the controller it it will do some
  709. 29:10validations if it successes then only it
  710. 29:12will come to the main application. Yeah.
  711. 29:14Same as like AOP spring AOP.
  712. 29:16>> Yep. Yep. Yep. Okay. Um moving ahead. Uh
  713. 29:22uh do you know about blue
  714. 29:24[clears throat] green deployment?
  715. 29:27>> Yes.
  716. 29:28>> Yeah. Please go ahead.
  717. 29:30Yeah. So basically we'll be using this
  718. 29:32in uh production deployments mainly
  719. 29:34because non-product okay somehow it goes
  720. 29:36down also uh we can ask some our testers
  721. 29:39to wait for some time and we can fix it
  722. 29:42but in case of production uh uh it will
  723. 29:44be a a big loss if goes down and it will
  724. 29:47be hectic until we resolve. So what
  725. 29:50we'll do is like uh
  726. 29:52>> uh we'll be using this uh blue green uh
  727. 29:55deployments in production mainly. M
  728. 29:57>> so we have two different types of
  729. 29:59environments. Blue is the which is in
  730. 30:02live for as for production and green
  731. 30:04will be uh which is about to go to the
  732. 30:06production. We can consider the new
  733. 30:08version. So this we'll be calling it as
  734. 30:09blue green version. Uh what we'll do uh
  735. 30:12we'll deploy this uh green environment
  736. 30:15like which is new environment while uh
  737. 30:18old uh blue is still uh serving the
  738. 30:22users. Once the uh this uh new version
  739. 30:26green deployment is uh completely tested
  740. 30:28and ready to use, we can switch the
  741. 30:30traffic from blue to green and we can
  742. 30:34decommission the blue and we can make
  743. 30:36the green uh instant lively for uh uh
  744. 30:39all the customers in prod.
  745. 30:42>> Okay. And also this will help us to roll
  746. 30:45back uh to the older one if something
  747. 30:48goes wrong uh uh uh anything went wrong
  748. 30:52during uh while testing in prod
  749. 30:55>> that also helps switching back easily.
  750. 30:58>> Yep. Yep. Okay. Okay. Sep now I will
  751. 31:02give you a few coding questions. Right.
  752. 31:06You are able I mean are you comfortable
  753. 31:09doing in stream API?
  754. 31:12Yes.
  755. 31:13>> Yes. And normal coding also, right?
  756. 31:16>> Yeah. Let's see if [laughter] it goes
  757. 31:19much.
  758. 31:20>> Okay. So, Sep uh can you please share
  759. 31:23your screen and open any editor, local
  760. 31:26editor or online editor, it's up to you.
  761. 31:28Oh,
  762. 31:29>> then I will share a quing question right
  763. 31:32one by one.
  764. 31:33>> Okay. All the IDs are my internal
  765. 31:37projects.
  766. 31:38All later. One second. Can you see this
  767. 31:41uh chrome tab? Yes. Yes, I could see.
  768. 31:44>> Mhm.
  769. 31:45>> Okay. So, the question is um you are
  770. 31:48given a list of uh numbers, right? And
  771. 31:54uh you have to print the top third
  772. 31:58number from the list.
  773. 32:03>> Okay.
  774. 32:04>> Okay.
  775. 32:04>> So, basically it's like uh Mhm. It's
  776. 32:07like highest third number.
  777. 32:10>> Highest third number.
  778. 32:11Okay. Yep. Yeah, please do it.
  779. 32:15>> Okay.
  780. 32:17Or else can I use this note? That's
  781. 32:19okay. Fine.
  782. 32:20>> Uh
  783. 32:21>> uh
  784. 32:22>> online editor is fine, I think.
  785. 33:05uh okay now what unique
  786. 33:13let me write the size
  787. 33:17is greater less than three because at
  788. 33:20least we need to have three numbers.
  789. 33:23This we are returning
  790. 33:27null to it. Else what we can do is like
  791. 33:31uh
  792. 33:33unique
  793. 33:34as it's say
  794. 33:38uh tree set we can have unique names dot
  795. 33:41iterator list type will be iterator
  796. 33:50iterator
  797. 33:56teacher we can call it as TR
  798. 34:01so
  799. 34:09dot it might be
  800. 34:12not sure
  801. 34:20next of
  802. 34:25wherever we want uh
  803. 34:28uh uh or return
  804. 34:31and uh here uh
  805. 34:34as we are calling it here
  806. 34:38in uh third highest number is equals to
  807. 34:43okay anyhow we have this right let me
  808. 34:46if
  809. 34:47>> okay so um sep
  810. 34:50>> yep yep so since you are
  811. 34:54>> uh since you are not using stream APIs
  812. 34:57right so This could be done like we
  813. 35:00could use collection dots sort then we
  814. 35:02could pass the list right
  815. 35:05>> I mean uh we don't need this tree set
  816. 35:09and all is it
  817. 35:15>> yes
  818. 35:18something like that
  819. 35:21[snorts]
  820. 35:22uh
  821. 35:22>> you could use collection sort and then
  822. 35:24sort in the reverse [clears throat]
  823. 35:25order
  824. 35:26>> and then we can direct ly print the
  825. 35:28third highest from the list.
  826. 35:30>> Yeah. U so yeah here uh what I am doing
  827. 35:34is like I'm creating array of dash list
  828. 35:35and uh uh I'm using preset just to uh
  829. 35:38remove some uh uh duplicate. There might
  830. 35:41be okay I'm using preset just to remove
  831. 35:44the duplicates collection. Reverse
  832. 35:46order.
  833. 35:47>> So we'll have uh something like that
  834. 35:49right?
  835. 35:51>> If unique nums do size is less than
  836. 35:54three return
  837. 35:55>> at least we need to have train. Mhm.
  838. 35:57>> iterator
  839. 35:59unique iterator. Next iterator. Okay.
  840. 36:02Got it.
  841. 36:03>> Something this maybe.
  842. 36:05>> Yep. That is also uh correct way. Uh we
  843. 36:08could do this. Um okay. So how would you
  844. 36:11do uh by using stream API? The same
  845. 36:14question
  846. 36:17>> using stream API.
  847. 36:18>> Mhm. Java 8 features.
  848. 36:23>> Okay. So if uh we don't want all these
  849. 36:27things now
  850. 36:28>> what we can do is like uh uh first of
  851. 36:32all
  852. 36:34uh we by default whenever we want to get
  853. 36:37uh nums dot stream we can use
  854. 36:41>> mhm before this what we have used we
  855. 36:44have used right so to remove duplicates
  856. 36:47we'll be using distinct here just to
  857. 36:49make sure it should not have any uh
  858. 36:52duplicates dot sort instead of uh uh
  859. 36:55comparator dot uh
  860. 36:59comparator
  861. 37:00dot
  862. 37:02reverse uh order method.
  863. 37:06>> Mhm.
  864. 37:07>> And then
  865. 37:09uh as we want uh third one right dot
  866. 37:12skip of uh two dot find first something
  867. 37:17like this
  868. 37:20>> maybe.
  869. 37:21>> Yes. Yes. like based on tree set and
  870. 37:24sorting order. This is replacement of
  871. 37:26tree set. Uh this is for uh uh
  872. 37:30collection dot reverse order. Uh this is
  873. 37:33for iterator two times and then find
  874. 37:35first something like that.
  875. 37:37>> Yep. Yep. That is correct. Okay. Okay.
  876. 37:40So let's say you are given a two string.
  877. 37:41One is a string and another is
  878. 37:43substring.
  879. 37:45Okay. And you have to check whether the
  880. 37:47substring
  881. 37:49is there in the main string or not. So
  882. 37:52how would you do that?
  883. 37:55>> With the help of uh index of that string
  884. 37:59exist.
  885. 38:01>> Yeah, please go ahead. Uh
  886. 38:06so okay. So basically we need a program
  887. 38:08if uh sub if a string has substring.
  888. 38:15Okay.
  889. 38:18Okay.
  890. 38:19>> And don't use any uh direct methods like
  891. 38:23uh there are some inbuilt methods sub
  892. 38:26str something like that.
  893. 38:31>> Okay.
  894. 38:37>> So just we want to find out that uh
  895. 38:40substring exist or not.
  896. 38:42>> Yes. Yes. For example, first string is
  897. 38:45>> I got it.
  898. 38:46>> Second string is deep d. [clears throat]
  899. 38:49So deep is here.
  900. 38:52>> Hello world something as this is the
  901. 38:54default program.
  902. 38:58If anyone wants to learn so let's
  903. 39:00consider uh string s2 or s1 is equals to
  904. 39:05uh world we can use the case sensitive
  905. 39:09as well. Uh what we can do if uh
  906. 39:13uh
  907. 39:17s dot uh index of s_ub_2
  908. 39:23it's uh
  909. 39:26uh if it gives greater than equals to
  910. 39:28zero
  911. 39:30this will give uh string exist in that
  912. 39:32if not true something like this
  913. 39:37that's it index of yeah mostly index X
  914. 39:40of is the main one. That's what uh I'm
  915. 39:42thinking
  916. 39:42>> contains we could use contains
  917. 39:45>> contains S1 contains of S2 that also
  918. 39:47true.
  919. 39:48>> And how what how would you do in uh
  920. 39:51stream Java features
  921. 40:03with help of uh streams same thing.
  922. 40:06Okay.
  923. 40:08uh may okay in case of this thing we'll
  924. 40:11be using index of right maybe uh with
  925. 40:14the help of uh uh what we call uh
  926. 40:20filters or uh contains. One second. Let
  927. 40:24me
  928. 40:25>> Yeah. Yeah. Contains we could use
  929. 40:28>> Yeah.
  930. 40:31>> One second. Uh
  931. 40:35okay. List of uh streams. Uh filter
  932. 40:39>> strontains then uh inside.
  933. 40:41>> Yeah. Yeah. That's it. Uh first we'll
  934. 40:43write uh yeah uh s dot. So it's not
  935. 40:48>> okay. So don't write it's fine. I just
  936. 40:50understood.
  937. 40:52>> Yeah. dot filters dot uh s dot contains
  938. 40:56of substring something
  939. 40:58>> of s1 what something
  940. 41:02>> maybe that this would be the complete
  941. 41:04skeleton but if you write the proper
  942. 41:05method that would become proper uh uh
  943. 41:08syntax
  944. 41:09>> okay so yes um so sep yes it's done from
  945. 41:13my end and it was a very very nice
  946. 41:14Interview.

About this transcript

This page contains the full transcript of Java Spring Boot 10+ Yrs Interview Experience [Lead Developer] by GenZ Career, generated from the public captions YouTube serves with the video. The transcript has 5,724 words across 946 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 choose a caption track available on the video.

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, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.