Fundamentals of java spring
Fundamentals of Spring Framework
Fundamental concepts related to Java Spring Framework:
Inversion of control
Spring context – ways to defines the instances or beans in the Spring context
GetBean from context – The class used to define the context has the match the Spring context that we intend to use
Classes that can be used for a desktop application:
AnnotationConfigApplicationContext – Loads a Spring application context from one or more Java based configuration classes. It implements Autocloseable and can be used as a resource directly, can be used in try with resources.
ClassPAthXmlApplicationContext – Loads a context definition from one or more XML files located in the classpath, treating context definitions files as classpath resources. This class waits that configuration files come with a relative path to the root, the application path.
FileSystemXmlApplicationContext – Loads a context definition from one or more XML files in the filesystem
To create a dependency injection, make use of bean tag.
How bean and xml config works.
Create a new dependency
Make a dependency through Constructor using arg tag.
Explicit configuration in XML
Explicit configuration in Java – declare a configuration class and use @bean to inject with a method
Implicit bean discovery and automatic wiring