@rkenmi - Spring - Basic Concept

Spring - Basic Concept


Spring - Basic Concept


Back to Top

Updated on January 13, 2020

Spring has an object called the "Bean Factory". This factory creates new objects, or rather, new Beans for us, without the need of instantiating via the new keyword.

The factory reads off of a Spring configuration file, which can either be a XML file stored locally, or a class annotated with @Configuration at compile-time. The latter is known as the Java based configuration, which is a more recent feature and strongly preferred over the former XML based configuration.

Beans that are created are contained inside the "Bean Factory". This "Bean Factory" is essentially the IoC (inversion-of-control) container inside Spring. We can then start using these beans by defining a dependency injection method (i.e. constructor injection, setter injection) coupled with the @Bean annotation. This allows us to have new objects created for us by Spring and in perfectly usable shape, without the need of manually instantiating the objects ourselves.


Article Tags:
SpringSpring Beans