Decoding Spring Bean scopes | Hands-On | Spring interview questions and answers for experienced
Вставка
- Опубліковано 5 сер 2024
- In this video, we will talk about spring bean scopes. This is one of the hot topics for the spring interview as well. So today, I will give you an in-depth deep dive on the 6 different bean scopes that we have.
We will explore various beans scopes like singleton, prototype, request, session, application, and WebSocket. Not only I will tell you about the uses of it, but also I will make you familiar with various spring interview questions.
This bean scope in the spring framework tutorial also covers a comparison between various scopes.
For example:
Singleton vs Prototype scope,
Request vs Session scope,
Request Vs Prototype scope and,
Singleton vs Application scope.
Note that these scopes comparison questions are popular spring interview questions both in the freshers and experienced category.
Prerequisite :
[ spring framework tutorial for beginners with examples ]
Spring Core basics :
• Spring framework tutor...
Spring MVC basics :
• Spring MVC course intr...
Spring MVC Java-based configuration :
• Spring MVC Java Based ...
Course contents :
spring bean scopes
Video Map: ⏱️TIMESTAMPS⏱️
Introduction: 00:00:00
[ The default scope of the bean ]
Singleton scoped bean: 00:10:16
Introducing @Scope spring annotation: 00:19:04
How to define Singleton scoped bean [Animations]: 00:20:15
Prototype scoped bean[example]: 00:21:53
[When to use singleton and prototype scope in spring]
Singleton vs prototype tricky question: 00:30:51
Bean Initialization (Singleton vs Prototype): 00:38:52
Injecting prototype bean inside a singleton bean: 00:47:00
singleton bean with prototype dependencies: 00:49:36
Injecting prototype scoped bean inside a singleton scoped bean Problem: 00:51:30
spring aop scoped proxy: 00:58:34
Introducing Spring CGLIB/ Proxy: 01:06:30
Singleton Scoped bean Vs GOF singleton design pattern: 01:26:40
singleton scope vs singleton pattern (Interview FAQ ): 01:37:30
@LookUp walkthrough: 01:13:37
lookup (abstract) method injection in spring: 01:20:00
@LookUp annotation homework/ Assignment : 01:25:53
Spring web-aware bean scopes: 01:38:29
Spring bean scope Assignment 02- 01:42:24
[Request scope in spring]
Request bean scope: 01:43:29
The standard way to define request scope: 02:10:29
Session bean scope: 02:11:50
Request Vs Prototype scoped bean: 02:19:29
Application scope theory: 02:25:39
Application scoped bean example: 02:41:32
Websocket bean scope: 03:14:29
This topic is popular for the “ spring interview questions and answers for experienced " and "spring interview questions and answers for freshers“ category. Make sure to explore every scenario that I have covered in this video. Make sure these are the same bean scopes that we use in spring boot as well.
#SpringBeanScopes #SpringFramework #SpringInterview
===================
For more courses visit
www.seleniumexpress.com
Any time you are getting stuck with issues, Feel free to ask for support.
You can send mail to seleniumexpress@gmail.com
you can ping me on my Facebook page.
/ seleniumexpress
Make sure to join my private Facebook page (Ask me here)
“SeleniumExpress - Support"
/ 187000222361579
you can ask for support in my website forum
www.seleniumexpress.com
Subscribe to my youtube channel
/ @seleniumexpress
Follow me on Insta
/ selenium_express
Music :
-----------
credits: -
(channel intro)
Adventures by A Himitsu / a-himitsu
Creative Commons - Attribution 3.0 Unported- CC BY 3.0
creativecommons.org/licenses/b...
Music released by Argofox • A Himitsu - Adventures...
Music provided by Audio Library • Adventures - A Himitsu...
Once you are done watching
Take this quiz :
www.seleniumexpress.com/quizzes/spring-bean-scopes/
See you guys soon !!
When we can do everything using Annotation's what is the need of using XML's ?
You looks like junior ntr !
And i secure 9 out of 9 score yeah today what i am in concept of scope all bcz of you sir😊
Hi I was unable to view my score post giving the quiz..
How to get the score?
I took leave today and watched 3 videos and spent more than 6 hours. Worth watching and utilized the time very well. Keep up the great work. Learnt a lot. Also your explanation is simple and clear to understand.
I didn't know I could sit and watch a 3 hr YT video studying, thank you so much
Without finishing the entire video, I am going to press Like first. In my personal opinion, you have the best explanations on the topic of Spring amongst all the youtubers on UA-cam! Thanks for teaching us and sharing your knowledge with us, you rock!!
No one can give such a useful videos with zero cost. Thanks abhilash.
My pleasure, Kamala !!
As usual ! Simple , Clean and Crystal Clear!!
Bro, you are the best!!! One of the best tutorials I have ever gone through.. you took so much care of your audience who is following!! Best best best!! Thank you very much..
Thank you very much for that video. I was looking for hours to a post or video that explains those concepts in details and this is the only one I found.
Love your style of teaching, passion and how you give real work example to make the concept undertandable.
BEST VIDEOS for SPRING MVC ! Thank you so much for your hardwork :)
So intuitive, and I just love the mode of delivery
nobody could ever made spring bean scope so easy, at least to me!!! Really enjoyed it!
Best Video on spring bean scope. Every second of this video is worth it!!! Thanks a lot Abhilash.
Very intuitive and well explained. It's 2 AM IST and I am still awake and just now finished the video. It's very interesting to learn things in simple words. Thanks for uploading such a great video. You are one of the best teacher on UA-cam.
This is an excellent explanation, I never had such an amazing explanation on spring bean scopes, Please keep doing it,Thanks a lot :)
Awesome Video Abhilash, no one will explain the bean scopes in such detailed manner. Hats Off to you
really awesome.God bless you always as you helping so many people by doing this... :) You are great
Thank you very much for this video. Never got bored of 3 hrs lecture. Waiting for web socket example.
What a wonderful explanation! Awesome Job
Thanks for all your lectures and giving us deep insight to java concepts.
Now i have fully understand entire scope and their usage.tq brother providing crisp and clear
Awesome content and representation. Appreciate your hard work.
Great content bro!🙌🏻 Thanks alot!🙏🏻
thank you very much for the great and simple explanation
Hats off to you....for sharing this wonderful knowledge free
You made a wonderful video. Explanation is quite simple and easy to understand
Good explanation of concepts. Please come up with more Spring Framework tutorials.
Great explanation, thank you!
Great abhilas! Keep up the good work!!
Amazing video!!!
Your way of teaching is awesome
Very nice explanation...you have covered a very important question that is asked frequently
Great job!!!
Thanks a lot for sharing.. 👏
Thank you so much Abhilash for the great video. Learned a lot from your videos.. 😇
Loved your videos. I have no words to thank you..have a request to please come up with spring boot/microservice
Thanks, really helpful
The background score in the middle was damn good sir it feels soo refreshing..
Hello from Kazakhstan. 16.10.2023 10:53 PM
Thank you very much for the video, especially this one.
I learned and understood a lot thanks to you, good luck!
me same, buddy. This guy definitely best teacher on UA-cam, I've ever seen.
wow ...great analysis ...very informative video
Hello Bro, U r genius. Hats up to your explanation...god bless u bro...
Sir, superb, very clear explanation, thanks a lot.
Worth watching 👍🙏
Superb finally i completed 3 hrs video within 8 hrs but feel very positive thanks sir ... please upload 2nd part of scope websocket and use of scope where to use what.. am waiting . . Lots of respect from odisha sir😊
It's really helpful, tnx Abhilash 😊
I am preparing for my interview right now and this is much helpful subscribed ur channel
Bro, Explain Microservises
God bless you brother
You are great sir 😊
Amazing content , best on utube , love from Russia
Well explained 👌
Ji sooper ji really excellent after watching your classes i love coding please update webservices and spring boot microservices
Nice one bro
Thnx u for ur services
Sir excellent 👍👍👍❤️❤️❤️ love u sir
Bro you are awesome... Please create a playlist zero to advanced for spring / spring boot... I dont know where to start
Excellent
I like all your videos....🙏🙏🙏
Hi sir,
Can you also explain difference now between 'gang of 4 singleton' class and spring's '@applicationScope' class
Thanks for awesome explanation as always. No one can do it better than you do.. !
thnxxxx abi i like ur videos
Thanks
waiting for realtime uses of scopes and also please explain briefly when to use dependency injection and new keyword while creating objects in realtime.
Your way of teaching is best but I like that music also which makes the learing more exciting....
U super duper spring Master
Good job
Level Up! ❤️
Waiting dude for your tutorial videos.
Atlast......👍🙏
On a tight schedule, Sudheer. Looking forward to post soon.
Hi, and thanks for that video. Did you publish the video about the websockets you mentioned at 3:16:00 ?
Thanks a lot please update spring boot tutorial and web services
2:14 in case of sessionscope , if i try to sent the request from curl command every time new object is creating . but from browser its working as expected
very Impressive
How to share applicationcontext between threads?basically i am using a distributed cache and each thread would need access to a bean created at startup…but I get an illegalstate exception…the exception makes sense because the child threads dont have the application context but how to get around this problem?
One way that i found was to replicate that bean in my cache’s instance but was wondering if there are any better ways to do this
Thanks youuuuuuuuuuuuuuuuuuuuuuuuuuuu a lot sir
Can you show pom o provide link to github? I've got an error "The matching wildcard is strict, but no declaration can be found for element 'context:annotation-config'." I don't know how to fix it.
Thanks for the great lecture, I'm also interested to build a custom Scope, how i can achieve it, any information could be great, Thanks.
this explanation is even better than the paid udemy courses
Hi... Could you please reply to my query?
I have a query at 1:55:23
The Testcontroller class is annotated with @controller annotation so it is now a singleton bean . If we use @autowired on MyBean object , then will it create only one instance of MyBean class?
Spring creates singleton bean only once and if autowire is used on MyBean then will it create the MyBean object with Testcontroller only once and use the same MyBean object for different requests?
Hi Abhilash dude,
When we are coding back to LOVE CALCULATOR project ?
Many students are waiting for the database(spring JDBC) connection for that project.
Kindly give update if possible 🙏.
& Thanks a lot for the efforts.
1:24:44 we made the School class as an abstract class and making bean out of it. Is it possible because we cant instantiate the abstract class
either before watching thank you
What is the scope of object created by a bean. I want to use a bean of an object which uses init method once and then that bean object is shared among the whole application. My init method calls s3 and imports a file. I don't want to do that on every instance.
Thank you Selenium Express
Hi Abhilash can you tell me how to check api call logs in kibana I am struggling with this
Why do we need to create 2 different or more than 2 application context for spring application? Can you share any usecase of that ? 1:38:10
How abstract class got instantiated..?(when we tried @lookup and made school class abstract)
Can we create an instance for abstract component in case of prototype bean scope ?
Hi Abhilash
Please do post videos on spring batch.
Hi Abhilash, It was a wonderful session !
Assignment 01:
While printing out two School objects, got Proxy Object as output. Unable to find the reason behind it.
Is it because the prototype bean generated as proxy by CGLib, singleton object too created by CGLib ?
around 01:26:00 q,
I think the school class is subclassed by cglib that's why you are getting this. But the student bean injected here is a real bean and not a prototype bean. Try making the School class as final you will get error regarding subclassing not allowed. This was similar to proxyMode added in Student class, here also the proxy object was created by cglib and gave me error of i try to make it as final (complaining that sub-classing is not allowed)
thanks! Just a query- @1:06:00 if we make the Student class as "singleton", then also, will the multiple objects be given thru the proxyMode?
no it won't it will give one student object... but internally first proxy object will be created and that will get a real student object(this part remains same)
at 1:23:19 u hv marked class as abstract then now that can be instantiated ?????
Hi abhilash, by using proxymode=scopedproxymode.TARGET_CLASS student constructor also called but using @lookup student constructor didn't call during school objection creation. could you please have a look on it.
This is great!!! If I make Student class as final, CGLIB giving error that Student class cannot be subclassed :D :D D
Hi! Thank you for the video. One more thing about your microphone, sometimes it is to loud to hear you, sometimes is too quiet. Just want you to know it
Application scope object is not created until we need it, then why @Autowired not fail? Does Spring ignore @Autowired check for property that depends on application scope component class?
Abstract classes cannot be instantiated. Then if we make the School class as Abstract, how can we create objects for the School class and it doesn't show any error here. Why?
Level up
Please create tutorial for microservices and spring boot
wow
What are some real world application of having to have multiple dispatcher servlets in one application?
Please create for springboot and microservices also
Also, we can create multiple Spring singleton scope beans of the same class, just with different names, because they are stored in a ConcurrentHashMap with the name, and each time you access them by name, you will get the same object.