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);
}
}