起因:
因为二开需要改造源码, 源框架是guice, 转成springboot 相关需要彼此访问对方的bean对象等
1. 访问spring的工具类
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Provider;
import com.google.inject.name.Names;
import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
/**
* guice 访问spring 工具类
* @param <T>
*/
@Component
public class GuiceBeanProviderFactory<T> extends AbstractModule implements ApplicationContextAware, BeanFactoryAware {
private final Logger log = Logger.getLogger(GuiceBeanPr