ASE/src/main/java/com/codesdream/ase/component/ASESpringUtil.java
Saturneric 0223c53d09 添加
2020-09-01 01:01:19 +08:00

23 lines
537 B
Java

package com.codesdream.ase.component;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 手动获得Bean的工具类
*/
@Component
public class ASESpringUtil {
@Resource
private ApplicationContext applicationContext;
public <T> T getBean(Class<T> tClass){
return applicationContext.getBean(tClass);
}
}