Showing posts with label Dependency Injection. Show all posts
Showing posts with label Dependency Injection. Show all posts

Spring - Initializing a Spring Bean

It is often required to run some custom code on initialization of a Spring bean. e.g. to check for mandatory properties or establish initial connections. Spring provides a few constructs to initialize the beans after they are injected with the properties.

Spring - Lookup Method or Method Injection

Most common injection mechanisms used in Spring are Constructor and Property injections. In both the mechanisms, the injection happens only once during the initialization of the Bean. They also require a concrete method defined e.g. a constructor method for constructor injections and a setter method for property injection.