- Dependency Injection
- Coding to Interface
- Aspect Oriented Programming
What is Dependency Injection?
Dependency Injection is used to decouple the dependence between the objects within a class and to provide the dependency (i.e. instantiation, initialization) from outside configuration to the class.
Factory Design Pattern is used in Spring Framework. Means instead of directly instantiating an
object, we ask the particular Object Factory to manage (create, maintain
lifecycle, destroy) the object and pass to us a reference of the object.
Spring uses:
1. BeanFactory
2. ApplicationContext
BeanFactory | ApplicationContext |
BeanFactory fcty = new XmlBeanFactory(new FileSystemResource(“userspringconfig.xml”)) | ApplicationContext fcty = new ClassPathXmlApplicationContext(“userspringconfig.xml”) |
org.springframework.beans.factory | org.springframework.context |
Simple | Heavy |
- | Supports Annotation based dependency Injection. |
- | Supports Internationalization (I18N) messages |
- | Supports many enterprise services such JNDI access, EJB integration, Remoting |
- | Can publish events to beans that are registered as listeners |
No comments:
Post a Comment