import org.springframework.beans.BeansException;  
import org.springframework.context.ApplicationContext;  
import org.springframework.context.ApplicationContextAware;  
  
public class SpringUtil implements ApplicationContextAware {  
  
    private static ApplicationContext applicationContext;  
  
    public static ApplicationContext getApplicationContext() {  
        return applicationContext;  
    }  
  
    public void setApplicationContext(ApplicationContext applicationContext)throws BeansException {  
        SpringUtil.applicationContext = applicationContext;  
    }  
}  
<?xml version="1.0"?>  
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">  
  
<beans>   
    <bean />  
</beans>  
private InfoBO infoBOProxy = (InfoBO) SpringUtil.getApplicationContext().getBean("infoBOProxy")

 

相关文章:

  • 2022-12-23
  • 2021-10-30
  • 2022-01-15
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2021-05-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-05-25
  • 2022-02-13
  • 2022-03-03
  • 2022-01-06
相关资源
相似解决方案