com.mycompany.beanstests.InitHelloWorld.java Source code

Java tutorial

Introduction

Here is the source code for com.mycompany.beanstests.InitHelloWorld.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.beanstests;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 *
 * @author george
 */
public class InitHelloWorld implements BeanPostProcessor {

    private static final Log LOG = LogFactory.getLog(InitHelloWorld.class);

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        LOG.info("++++++++++++++++++ BeforeInitialization : " + beanName);
        return bean; // you can return any other object as well
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        LOG.info("(\"++++++++++++++++++ AfterInitialization : " + beanName);
        return bean; // you can return any other object as well
    }

}