当前位置: 首页>>代码示例>>Java>>正文


Java BeanFactoryUtils.beanOfTypeIncludingAncestors方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAncestors方法的典型用法代码示例。如果您正苦于以下问题:Java BeanFactoryUtils.beanOfTypeIncludingAncestors方法的具体用法?Java BeanFactoryUtils.beanOfTypeIncludingAncestors怎么用?Java BeanFactoryUtils.beanOfTypeIncludingAncestors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.BeanFactoryUtils的用法示例。


在下文中一共展示了BeanFactoryUtils.beanOfTypeIncludingAncestors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: autodetectViewConfig

import org.springframework.beans.factory.BeanFactoryUtils; //导入方法依赖的package包/类
protected ScriptTemplateConfig autodetectViewConfig() throws BeansException {
	try {
		return BeanFactoryUtils.beanOfTypeIncludingAncestors(
				getApplicationContext(), ScriptTemplateConfig.class, true, false);
	}
	catch (NoSuchBeanDefinitionException ex) {
		throw new ApplicationContextException("Expected a single ScriptTemplateConfig bean in the current " +
				"Servlet web application context or the parent root context: ScriptTemplateConfigurer is " +
				"the usual implementation. This bean may have any name.", ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:ScriptTemplateView.java

示例2: customize

import org.springframework.beans.factory.BeanFactoryUtils; //导入方法依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
	if (this.managementServerProperties == null) {
		this.managementServerProperties = BeanFactoryUtils
				.beanOfTypeIncludingAncestors(this.beanFactory,
						ManagementServerProperties.class);
		this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
				this.beanFactory, ServerProperties.class);
	}
	// Customize as per the parent context first (so e.g. the access logs go to
	// the same place)
	this.server.customize(container);
	// Then reset the error pages
	container.setErrorPages(Collections.<ErrorPage>emptySet());
	// and the context path
	container.setContextPath("");
	// and add the management-specific bits
	container.setPort(this.managementServerProperties.getPort());
	if (this.managementServerProperties.getSsl() != null) {
		container.setSsl(this.managementServerProperties.getSsl());
	}
	container.setServerHeader(this.server.getServerHeader());
	container.setAddress(this.managementServerProperties.getAddress());
	container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:26,代码来源:EndpointWebMvcChildContextConfiguration.java

示例3: customize

import org.springframework.beans.factory.BeanFactoryUtils; //导入方法依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
	if (this.managementServerProperties == null) {
		this.managementServerProperties = BeanFactoryUtils
				.beanOfTypeIncludingAncestors(this.beanFactory,
						ManagementServerProperties.class);
		this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
				this.beanFactory, ServerProperties.class);
	}
	// Customize as per the parent context first (so e.g. the access logs go to
	// the same place)
	this.server.customize(container);
	// Then reset the error pages
	container.setErrorPages(Collections.<ErrorPage>emptySet());
	// and the context path
	container.setContextPath("");
	// and add the management-specific bits
	container.setPort(this.managementServerProperties.getPort());
	container.setServerHeader(this.server.getServerHeader());
	container.setAddress(this.managementServerProperties.getAddress());
	container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:23,代码来源:EndpointWebMvcChildContextConfiguration.java

示例4: autodetectVelocityEngine

import org.springframework.beans.factory.BeanFactoryUtils; //导入方法依赖的package包/类
/**
 * Autodetect a VelocityEngine via the ApplicationContext.
 * Called if no explicit VelocityEngine has been specified.
 * @return the VelocityEngine to use for VelocityViews
 * @throws BeansException if no VelocityEngine could be found
 * @see #getApplicationContext
 * @see #setVelocityEngine
 */
protected VelocityEngine autodetectVelocityEngine() throws BeansException {
	try {
		VelocityConfig velocityConfig = BeanFactoryUtils.beanOfTypeIncludingAncestors(
				getApplicationContext(), VelocityConfig.class, true, false);
		return velocityConfig.getVelocityEngine();
	}
	catch (NoSuchBeanDefinitionException ex) {
		throw new ApplicationContextException(
				"Must define a single VelocityConfig bean in this web application context " +
				"(may be inherited): VelocityConfigurer is the usual implementation. " +
				"This bean may be given any name.", ex);
	}
}
 
开发者ID:ghimisradu,项目名称:spring-velocity-adapter,代码行数:22,代码来源:VelocityView.java

示例5: autodetectConfiguration

import org.springframework.beans.factory.BeanFactoryUtils; //导入方法依赖的package包/类
/**
 * Autodetect a {@link FreeMarkerConfig} object via the ApplicationContext.
 * @return the Configuration instance to use for FreeMarkerViews
 * @throws BeansException if no Configuration instance could be found
 * @see #getApplicationContext
 * @see #setConfiguration
 */
protected FreeMarkerConfig autodetectConfiguration() throws BeansException {
	try {
		return BeanFactoryUtils.beanOfTypeIncludingAncestors(
				getApplicationContext(), FreeMarkerConfig.class, true, false);
	}
	catch (NoSuchBeanDefinitionException ex) {
		throw new ApplicationContextException(
				"Must define a single FreeMarkerConfig bean in this web application context " +
				"(may be inherited): FreeMarkerConfigurer is the usual implementation. " +
				"This bean may be given any name.", ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:FreeMarkerView.java


注:本文中的org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAncestors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。