Spring Dependency Injection Basics

Spring Dependency Injection ● A kind of Inversion of Control (IoC) ● “Hollywood Principle”          – Don’t call me, I’ll call you ● “Container” resolves (injects) dependencies of components by setting implementation object (push) ● As opposed to component instantiating or Service Locator pattern where component locates implementation (pull) ● Martin Fowler calls it Dependency Injection. Benefits of… Read More Spring Dependency Injection Basics

Spring Basics

What is Spring Framework? ● Light-weight yet comprehensive framework for building Java SE and Java EE applications. Key Features – DI ● JavaBeans-based configuration management, applying Inversion-of-Control principles, specifically using the Dependency Injection (DI) technique          – This aims to eliminate manual wiring of components ● A core bean factory, which is usable… Read More Spring Basics

Transaction management

BEA WebLogic On WebLogic 8.1 or above, you will generally prefer to use the WebLogicJtaTransactionManager instead of the stock JtaTransactionManager class. This special WebLogic-specific subclass of the normal JtaTransactionManager supports the full power of Spring’s transaction definitions in a WebLogic-managed transaction environment, beyond standard JTA semantics: Features include transaction names, per-transaction isolation levels, and proper… Read More Transaction management

The Spring ApplicationContext

ApplicationContext is an extension of BeanFactory: it provides all the same functionality, but it reduces the amount of code you need to interact with it and adds new features into the pot for good measure. When using an ApplicationContext, you can control bean instantiation declaratively on a bean-by-bean basis, and any BeanPostProcessors and BeanFactoryPostProcessors registered in the ApplicationContext are… Read More The Spring ApplicationContext

The BeanPostProcessor

The BeanPostProcessor Sometimes, youmay find yourself in a position where you need to performsome additional processing immediately before and after Spring instantiates the bean. The processing can be as simple as modifying the bean or as complex as returning a completely different object! The BeanPostProcessor interface has two methods: postProcessBeforeInitialization, which is called before Spring calls any bean initialization… Read More The BeanPostProcessor

The BeanFactoryPostProcessor

The BeanFactoryPostProcessor The concept of the BeanFactoryPostProcessor is similar to the BeanPostProcessor: the BeanFactoryPostProcessor executes after Spring has finished constructing the BeanFactory but before the BeanFactory constructs the beans.Using the BeanFactoryPostProcessor, we can adapt the beans’ values according to the BeanFactory’s environment BeanFactory Post-Processors in Spring AspectJWeavingEnabler  – This post-processor registers AspectJ’s ClassPreProcessorAgentAdapter to be… Read More The BeanFactoryPostProcessor

Using FactoryBean

Using FactoryBean Spring provides the FactoryBean interface that acts as an adaptor for objects that cannot be created and managed using the standard Spring semantics. Typically, you use a FactoryBean to create beans you cannot use the new operator to create, such as those you access through static factory methods, although this is not always the… Read More Using FactoryBean