29 lines
747 B
Java
29 lines
747 B
Java
package com.adc.da.common;
|
|
|
|
/**
|
|
* @Description: TODO
|
|
* @author: super_liu
|
|
* @date: 2022年05月27日 14:26
|
|
*/
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.ApplicationContextAware;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@Component
|
|
public class GetBeanUtil implements ApplicationContextAware {
|
|
private static ApplicationContext applicationContext;
|
|
|
|
public void setApplicationContext(ApplicationContext context) {
|
|
GetBeanUtil.applicationContext = context;
|
|
}
|
|
|
|
public static Object getBean(String name) {
|
|
return applicationContext.getBean(name);
|
|
}
|
|
|
|
public static ApplicationContext getApplicationContext() {
|
|
return applicationContext;
|
|
}
|
|
}
|