package me.chyxion.tigon.webmvc.war;

import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.AbstractRefreshableApplicationContext;

/**
 * Disable Bean Definition Override
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Jan 23, 2015 12:19:07 PM
 */
public class AppContextInitializer 
    implements ApplicationContextInitializer<ConfigurableApplicationContext> {

    /**
     * {@inheritDoc}
     */
    @Override
    public void initialize(ConfigurableApplicationContext appContext) {
        if (appContext instanceof AbstractRefreshableApplicationContext) {
            ((AbstractRefreshableApplicationContext) appContext)
                .setAllowBeanDefinitionOverriding(false);
       }
    }
}
