0
https://www.udemy.com/spring-hibernate-tutorial/learn/v4/content
inversion of control
dependency injection
1. Spring Container
1.1 Primary functions
Create and manage object(Inversion of Control)
Inject object's dependencies(Dependency Injection)
1.2 Configuring Spring Container
XML configuration file(legacy, but most legacy apps still use this)
Java Annotations(modern)
Java Source Code(modern)
2. Spring Development Process--Inversion of control
Configure your Spring Beans
Create a Spring Container
Retrieve Beans from Spring Container
Step2: Create a Spring Container
Spring container is generically known as ApplicationContext
Specialized implementations
ClassPathXmlApplicationContext: helps to fetch beans defined in xml. ClassPathXmlApplicationContext loads xml files from the classpath.
AnnotationConfigApplicationContext
GenericWebApplicationContext
others....
There are many types of Injections with Spring, the two most common are: Constructor Injection and Setter Injection.
3.1 Development process--Constructor Injection
Define the dependency interface and class.
Create a constructor in your class for Injections
Configure the dependency injection in Spring config file
3.2 Development process--Setter Injection
Create setter methods in your class for Injections
3.3 Injecting Literal Values
development process--injecting literal values
Create setter methods in your class for Injections
3.4 Injecting Values from a Properties File
development process
Create Properties File
Load Properties File in Spring config file
Reference values from Properties File
Last updated