Loading...

REAL-TIME: Spring Bean life cycle using @PostConstruct |@PreDestroy |init - method| destroy -method

134633 2098________

This tutorial covers the spring bean life cycle with a real-time example."Implement spring life cycle methods in a simple JDBC application” this might be a good question for spring core interview to test candidates spring core knowledge and we will be doing it today in multiple ways. There are multiple ways to configure bean life cycles methods in your spring application as described below.
1.Using spring core annotations (@PostConstruct and @PreDestroy)
2.Using spring XML configuration(init-method and destroy-method)
3.Implementing interfaces like Iinitializingbean and disposablebean

So let’s solve the puzzle by each of this approach.

We will be also covering how to destroy the spring container (application context)?
difference between close() and registerShutdownHook().
abstractapplicationcontext in spring, which might be pretty useful for spring interview.

I will recommend you to code it with me which will make you comfortable with the lifecycle concept.

So, The first task for us is to create a database connection(MySQL) using simple JDBC and then we will go ahead and explore all the concept regarding the spring beans life cycle.

Download Spring Jars
repo.spring.io/artifactory/libs-release/org/spring…

For more videos in spring framework, consider subscribing by clicking the link below.

   / @seleniumexpress  

Stay tuned and like my Facebook page for more.

www.facebook.com/seleniumexpress

You can write your unsolved query to seleniumexpress@gmail.com.

#BeanLifeCycle #Spring #Bean
intro template :
youtube.com/Alexbau01

コメント