Tag: init-method
-
Executing code on the creation or destruction of a bean in Spring
There are 3 ways to execute code to create a bean in Spring: with the annotation @PostConstruct implementing the interface InitializingBean configuring the property init-method The reason why you run code when you create a bean is often to check the dependencies, and assign a default value, or automated actions such as starting a scheduled…