让Spring架构减化事务配置 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-18
* <p> * Default is "false".Can be overridden to enforce running in a context * (i.e.to throw IllegalStateException on accessors if outside a context). * * @see #getApplicationContext * @see #getMessageSourceAccessor */ protected boolean isContextRequired() ...{ return true; } /**//** * Determine the context class that any context passed to * <code>setApplicationContext</code> must be an instance of.Can be * overridden in subclasses. * * @see #setApplicationContext */ protected Class requiredContextClass() ...{ return ApplicationContext.class; } /**//** * Return the ApplicationContext instance used by this object. */ public final ApplicationContext getApplicationContext() throws IllegalStateException ...{ if (this.applicationContext == null && isContextRequired()) ...{ throw new IllegalStateException( "ApplicationObjectSupport instance [" + this + "] does not run in an ApplicationContext"); } return applicationContext; } /**//** * Return a MessageSourceAccessor for the application context used by this * object, for easy message access. * * @throws IllegalStateException * if not running in an ApplicationContext */ protected final MessageSourceAccessor getMessageSourceAccessor() throws IllegalStateException ...{ if (this.messageSourceAccessor == null && isContextRequired()) ...{ throw new IllegalStateException( "ApplicationObjectSupport instance [" + this + "] does not run in an ApplicationContext"); } return this.messageSourceAccessor; } public void setClassTypes(String[] classTypes) ...{ this.classTypes = Arrays.asList(classTypes); } /**//** * Subclasses can override this for custom initialization behavior.Gets * called by <code>setApplicationContext</code> after setting the context * instance. * <p> * Note: Does </i>not</i> get called on reinitialization of the context but * rather just on first initialization of this object''s context reference. * * @throws ApplicationContextException * in case of initialization errors * @throws BeansException * if thrown by ApplicationContext methods * @see #setApplicationContext */ protected void initApplicationContext() throws BeansException ...{ } //----------------------------------- //实现InitializingBean接口方法 //----------------------------------- /**//** * 查找指定classType的beanName列表 */ private List getBeanNames(String classType) ...{ List beanNameList = null; try |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于让Spring架构减化事务配置 - 编程入门网的所有评论