applicationcontextwrapper.java
来自「项目支付宝批量打款,采用httpclient+spring +quarz实现.」· Java 代码 · 共 51 行
JAVA
51 行
package com.szhelper.pay;import java.util.List;import java.util.Map;import org.springframework.context.ApplicationContext;/** * This class aim to simplify the work of getting bean instance from * ApplicationContext. this class define explicit methods. This class apply to * singltton pattern, it should be initialised at the startup of application. * NOTE: the setApplicationContext() should be invoked just after the * instantiation. * * @author fangxiang * @version 1.0, 2008-6-6 */public class ApplicationContextWrapper { private static ApplicationContextWrapper beansFactory = new ApplicationContextWrapper(); // spring Application context private ApplicationContext appContext; private ApplicationContextWrapper() { } public static ApplicationContextWrapper getInstance() { return beansFactory; } /** * ApplicationContext must be set just after the first instantiation of * BeansFactory. * * @param appContext * the sprint ApplicationContext. */ public void setApplicationContext(ApplicationContext appContext) { this.appContext = appContext; } public ApplicationContext getApplicationContext() { return this.appContext; } public Object getBean(String beanName){ return getApplicationContext().getBean(beanName); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?