/** * 封裝Spring ApplicationConext引用, 方便工程透過API獲取bean例項 * @author bjb-336 * */@Componentpublic class SpringContextWrapper implements ApplicationContextAware{ private static ApplicationContext appContext; /** * 根據beanName 獲取bean例項 * @param beanName * @return */ public static Object getBean(String beanName){ Object obj = null; if (null != appContext){ obj = appContext.getBean(beanName); } return obj; } /** * 根據bean名稱和型別進行獲取Bean的例項 * @param beanName * @param clsType * @return */ public static
/** * 封裝Spring ApplicationConext引用, 方便工程透過API獲取bean例項 * @author bjb-336 * */@Componentpublic class SpringContextWrapper implements ApplicationContextAware{ private static ApplicationContext appContext; /** * 根據beanName 獲取bean例項 * @param beanName * @return */ public static Object getBean(String beanName){ Object obj = null; if (null != appContext){ obj = appContext.getBean(beanName); } return obj; } /** * 根據bean名稱和型別進行獲取Bean的例項 * @param beanName * @param clsType * @return */ public static