View RSS Feed

All Blog Entries

  1. How to Write a BeanPostProcessing in Spring

    by , 11-16-2011 at 04:28 PM
    In the previous tip we talked about special beans in Spring. One of the Spring’s special beans that I had mentioned was using the BeanPostProcessor interface in order to cut into the bean’s life cycle and review or alter its configuration. In this tip, I will show you how to wire one. As mentioned in the previous tip I mentioned that the BeanPostProcessor provides two methods to alter the bean after it has been created and wired:

    Java Code:
    Object postProcessBeforeInitialization(Object bean,
    ...
  2. Spring's Special Beans

    by , 11-16-2011 at 04:25 PM
    The majority of beans in Spring are configured by the Spring container and made available for use in the application. Apart from these standard beans, Spring also has groups of beans that each serve a special purpose. The way in which Spring identifies these beans is because these beans have implemented certain interfaces that Spring considers special. The use of these interfaces allows these beans to do the following:
    • Post processing bean configuration in order to be involved in the bean
    ...
    Categories
    Bean , Configuration , XML
  3. Listening for Events with Spring

    by , 11-16-2011 at 04:03 PM
    During the application life cycle, the ApplicationContext will publish a handful of events that tell interested listeners what’s going on. All of these events are all subclasses of the abstract class org.springframework.context.ApplicationEvent. A couple of these subclasses are:
    • ContextClosedEvent—Published when the application context is closed
    • ContextRefreshedEvent—Published when the application context is initialized or refreshed
    • RequestHandledEvent—Published within a web application
    ...
    Categories
    Event
  4. Contextualized Dependency Lookup in Spring

    by , 11-16-2011 at 12:16 PM
    At its core, Inversion of Control (IoC), and therefore Dependency Injection (DI) offers a mechanism for provisioning component dependencies and managing these dependencies throughout their lifecycles. A component that requires certain dependencies is often referred to as the dependent object or, in the case of IoC, the target. Generally, IoC can be broken down into two subtypes: Dependency Injection and Dependency Lookup. With Dependency Lookup IoC, a component must obtain a reference to a dependency. ...
  5. Looking at Spring's Bean Factories

    by , 11-15-2011 at 02:17 PM
    BeanFactory serves as the core to Spring's Dependency Injection implementation. A BeanFactory is responsible for managing components and their dependencies. Bean is the term used in Spring to refer to any component managed by the container. Typically all Spring beans adhere, at some level, to the JavaBeans specification, although it is not required. The most obvious case of Spring deviating from the JavaBean specification is with the use of Constructor Injection to wire your beans together. ...
    Categories
    Uncategorized
  6. Looking at the Spring Application Context

    by , 11-15-2011 at 02:13 PM
    In order to take advantage of the full power of the Spring framework, you need to use Spring’s most advanced container, the application context. The ApplicationContext is similar to a BeanFactory. Both load bean definitions, wire beans together, and dispense beans upon request. But an ApplicationContext also does the following:
    • Application contexts provide a generic way to load other resources, such as images.
    • Application contexts can publish events to beans that are registered as listeners.
    • Application
    ...

    Updated 11-30-2011 at 11:46 AM by Spring Framework

    Categories
    Application Context
  7. Using Constructor Injection with Spring

    by , 11-15-2011 at 02:09 PM
    As we had mentioned in a previous tip, Inversion of Control (IoC) can be divided into two subtypes. There is Dependency Lookup which has two types, Contextualized Dependency Lookup and Dependency Pull); and Dependency Injection which also has two types, Constructor Injection and Setter Injection. In this tip we will look at Constructor Dependency Injection. Constructor Dependency Injection is Dependency Injection where a component's dependencies are provided to it in its constructor(s). The component ...

    Updated 11-30-2011 at 11:43 AM by Spring Framework

    Categories
    Dependency Injection
  8. Using Setter Injection in Spring

    by , 11-15-2011 at 02:02 PM
    An object is created in the Spring IOC container by invoking the zero-argument constructor. In this Setter Dependency Injection, the IoC container injects a component's dependencies into the component via JavaBean-style setter methods. A component's setters expose the set of the dependencies the IoC container can manage The dependent object is then passed as a parameter to the setter method. The CarService object needs data access objects (DAO) to execute data- base operations. The data access ...

    Updated 11-15-2011 at 02:10 PM by Spring Framework (Error in constructor for class)

    Categories
    Dependency Injection , Bean , Configuration
Page 2 of 2 FirstFirst 12