// Path: tcc-transaction-core/src/main/java/org/pankai/tcctransaction/support/BeanFactory.java
// public interface BeanFactory {
// 
//     Object getBean(Class<?> clazz);
// 
// }
// 
// Path: tcc-transaction-core/src/main/java/org/pankai/tcctransaction/support/BeanFactoryAdapter.java
// public class BeanFactoryAdapter {
// 
//     private static BeanFactory beanFactory;
// 
//     public static Object getBean(Class<?> clazz) {
//         return beanFactory.getBean(clazz);
//     }
// 
//     public static void setBeanFactory(BeanFactory beanFactory) {
//         BeanFactoryAdapter.beanFactory = beanFactory;
//     }
// }


import org.pankai.tcctransaction.support.BeanFactory;
import org.pankai.tcctransaction.support.BeanFactoryAdapter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
package org.pankai.tcctransaction.spring.support;


/**
 * Created by pktczwd on 2016/12/20.
 */
@Component
public class TccBeanPostProcessor implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        ApplicationContext applicationContext = event.getApplicationContext();
        if (applicationContext.getParent() == null) {
// Path: tcc-transaction-core/src/main/java/org/pankai/tcctransaction/support/BeanFactory.java
// public interface BeanFactory {
// 
//     Object getBean(Class<?> clazz);
// 
// }
// 
// Path: tcc-transaction-core/src/main/java/org/pankai/tcctransaction/support/BeanFactoryAdapter.java
// public class BeanFactoryAdapter {
// 
//     private static BeanFactory beanFactory;
// 
//     public static Object getBean(Class<?> clazz) {
//         return beanFactory.getBean(clazz);
//     }
// 
//     public static void setBeanFactory(BeanFactory beanFactory) {
//         BeanFactoryAdapter.beanFactory = beanFactory;
//     }
// }


// Path: tcc-transaction-spring/src/main/java/org/pankai/tcctransaction/spring/support/TccBeanPostProcessor.java
import org.pankai.tcctransaction.support.BeanFactory;
import org.pankai.tcctransaction.support.BeanFactoryAdapter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

package org.pankai.tcctransaction.spring.support;


/**
 * Created by pktczwd on 2016/12/20.
 */
@Component
public class TccBeanPostProcessor implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        ApplicationContext applicationContext = event.getApplicationContext();
        if (applicationContext.getParent() == null) {
            BeanFactoryAdapter.setBeanFactory(applicationContext.getBean(BeanFactory.class));