Spring Framework AbstractBeanDefinition - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AbstractBeanDefinition class.

This code example shows how to use the following methods:getPropertyValues, setRole, setSource
	 * Registers  an {@link HttpRequestHandlerAdapter} under a well-known 
	 * name unless already registered. 
	 */ 
	private static void registerBeanNameUrlHandlerMapping(ParserContext parserContext, Object source) {
		if (!parserContext.getRegistry().containsBeanDefinition(BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME)){
			RootBeanDefinition beanNameMappingDef = new RootBeanDefinition(BeanNameUrlHandlerMapping.class);
			beanNameMappingDef.setSource(source);
			beanNameMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
			beanNameMappingDef.getPropertyValues().add("order", 2);	// consistent with WebMvcConfigurationSupport
			parserContext.getRegistry().registerBeanDefinition(BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME, beanNameMappingDef);
			parserContext.registerComponent(new BeanComponentDefinition(beanNameMappingDef, BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME));
		} 
	} 
 
	/** 
	 * Registers  an {@link HttpRequestHandlerAdapter} under a well-known 
	 * name unless already registered. 
	 */ 
	private static void registerHttpRequestHandlerAdapter(ParserContext parserContext, Object source) {
		if (!parserContext.getRegistry().containsBeanDefinition(HTTP_REQUEST_HANDLER_ADAPTER_BEAN_NAME)) {
8
CodeRank
This code example shows how to use the following methods:getPropertyValues, setRole, setSource
This code example shows how to use the following methods:setBeanClass, setBeanClassName, setLazyInit, setScope, validate
	@Override 
	protected final AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
		BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition();
		String parentName = getParentName(element);
		if (parentName != null) {
			builder.getRawBeanDefinition().setParentName(parentName);
		} 
		Class<?> beanClass = getBeanClass(element);
		if (beanClass != null) {
			builder.getRawBeanDefinition().setBeanClass(beanClass);
		} 
		else { 
			String beanClassName = getBeanClassName(element);
			if (beanClassName != null) {
				builder.getRawBeanDefinition().setBeanClassName(beanClassName);
			} 
		} 
		builder.getRawBeanDefinition().setSource(parserContext.extractSource(element));
		if (parserContext.isNested()) {
			// Inner bean definition must receive same scope as containing bean. 

7
CodeRank
This code example shows how to use the following methods:validate, hasAttribute, setAttribute
		return attributeName.equals("resource-loader-path");
	} 
 
	@Override 
	protected void postProcess(BeanDefinitionBuilder builder, Element element) {
		if (!builder.getBeanDefinition().hasAttribute("resourceLoaderPath")) {
			builder.getBeanDefinition().setAttribute("resourceLoaderPath", "/WEB-INF/");
		} 
	} 
} 

7
CodeRank
This code example shows how to use the following methods:setBeanClass, setRole, validate
	static void autoregisterJsrBeansForNamespace(ParserContext parserContext) {
		autoRegisterJobProperties(parserContext);
		autoRegisterBatchPostProcessor(parserContext);
		autoRegisterJsrAutowiredAnnotationBeanPostProcessor(parserContext);
		autoRegisterThreadLocalClassloaderBeanPostProcessor(parserContext);
		autoRegisterBeanScopeBeanFactoryPostProcessor(parserContext);
		autoRegisterBatchPropertyContext(parserContext);
		autoRegisterNamespacePostProcessor(parserContext);
	} 
 
	private static void autoRegisterNamespacePostProcessor(ParserContext parserContext) {
		registerPostProcessor(parserContext, JsrNamespacePostProcessor.class, BeanDefinition.ROLE_INFRASTRUCTURE, JSR_NAMESPACE_POST_PROCESSOR);
	} 
 
	private static void autoRegisterBeanScopeBeanFactoryPostProcessor( 
			ParserContext parserContext) {
		registerPostProcessor(parserContext, JsrBeanScopeBeanFactoryPostProcessor.class, BeanDefinition.ROLE_INFRASTRUCTURE, BEAN_SCOPE_POST_PROCESSOR_BEAN_NAME);
	} 
 
	private static void autoRegisterBatchPostProcessor(ParserContext parserContext) {

7
CodeRank
This code example shows how to use the following methods:getPropertyValues, setRole, setSource
This code example shows how to use the following methods:setBeanClass, setFactoryMethodName, validate

7
CodeRank
This code example shows how to use the following methods:getPropertyValues, getConstructorArgumentValues, setBeanClass
7
CodeRank
This code example shows how to use the following methods:setBeanClass, setFactoryMethodName, validate

7
CodeRank
This code example shows how to use the following methods:setBeanClass, setRole, setSource
			beanDefs.add(registerPostProcessor(registry, def, COMMON_ANNOTATION_PROCESSOR_BEAN_NAME));
		} 
 
		// Check for JPA support, and if present add the PersistenceAnnotationBeanPostProcessor. 
		if (jpaPresent && !registry.containsBeanDefinition(PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME)) {
			RootBeanDefinition def = new RootBeanDefinition();
			try { 
				def.setBeanClass(ClassUtils.forName(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME,
						AnnotationConfigUtils.class.getClassLoader()));
			} 
			catch (ClassNotFoundException ex) {
				throw new IllegalStateException(
						"Cannot load optional framework class: " + PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, ex);
			} 
			def.setSource(source);
			beanDefs.add(registerPostProcessor(registry, def, PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME));
		} 
 
		return beanDefs;
	} 

7
CodeRank
See Code Examples for Spring Framework AbstractBeanDefinition Methods: