码上敲享录 > Spring框架常见问题详解分享 > ApplicationContextAware最简单用法

ApplicationContextAware最简单用法

上一章章节目录下一章 2018-06-03已有356人阅读 评论(0)

ApplicationContextAware最简单用法

答:以例子说话

import com.bx.cloud.common.auth.SessionManager;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class SessionManagerFactory implements ApplicationContextAware {
private static Map<String, SessionManager> sessionManager;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
       sessionManager = applicationContext.getBeansOfType(SessionManager.
class);
}
}

本文地址:http://www.yayihouse.com/yayishuwu/chapter/1283

0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交