Spring Framework BeanFactory - 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 BeanFactory class.

This code example shows how to use the following methods:containsBean, getBean
 
	@Override 
	public Object getAttribute(String name) {
		if ((this.explicitAttributes == null || !this.explicitAttributes.contains(name)) &&
				(this.exposedContextBeanNames == null || this.exposedContextBeanNames.contains(name)) &&
				this.webApplicationContext.containsBean(name)) {
			return this.webApplicationContext.getBean(name);
		} 
		else { 
			return super.getAttribute(name);
		} 
	} 
 
	@Override 
	public void setAttribute(String name, Object value) {
		super.setAttribute(name, value);
		if (this.explicitAttributes == null) {
			this.explicitAttributes = new HashSet<String>(8);
		} 
		this.explicitAttributes.add(name);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:containsBean, getType
	@Override 
	public Class<?> getType(ELContext elContext, Object base, Object property) throws ELException {
		if (base == null) {
			String beanName = property.toString();
			BeanFactory bf = getBeanFactory(elContext);
			if (bf.containsBean(beanName)) {
				elContext.setPropertyResolved(true);
				return bf.getType(beanName);
			} 
		} 
		return null; 
	} 
 
	@Override 
	public void setValue(ELContext elContext, Object base, Object property, Object value) throws ELException {
		if (base == null) {
			String beanName = property.toString();
			BeanFactory bf = getBeanFactory(elContext);
			if (bf.containsBean(beanName)) {
				if (value == bf.getBean(beanName)) {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:containsBean, getBean
	 * @return the MultipartResolver instance, or {@code null} if none found 
	 */ 
	protected MultipartResolver lookupMultipartResolver() { 
		WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); 
		String beanName = getMultipartResolverBeanName(); 
		if (wac != null && wac.containsBean(beanName)) { 
			if (logger.isDebugEnabled()) { 
				logger.debug("Using MultipartResolver '" + beanName + "' for MultipartFilter"); 
			} 
			return wac.getBean(beanName, MultipartResolver.class); 
		} 
		else { 
			return this.defaultMultipartResolver; 
		} 
	} 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:containsBean, getBean
				WebApplicationContext wac = (WebApplicationContext) base; 
				String beanName = property.toString(); 
				if (logger.isTraceEnabled()) { 
					logger.trace("Attempting to resolve property '" + beanName + "' in root WebApplicationContext"); 
				} 
				if (wac.containsBean(beanName)) { 
					if (logger.isDebugEnabled()) { 
						logger.debug("Successfully resolved property '" + beanName + "' in root WebApplicationContext"); 
					} 
					elContext.setPropertyResolved(true); 
					try { 
						return wac.getBean(beanName); 
					} 
					catch (BeansException ex) { 
						throw new ELException(ex); 
					} 
				} 
				else { 
					// Mimic standard JSF/JSP behavior when base is a Map by returning null. 
					return null; 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getBean, isSingleton
		else if (this.propertyPath == null) {
			// either targetObject or targetBeanName specified 
			throw new IllegalArgumentException("'propertyPath' is required");
		} 
 
		if (this.targetBeanWrapper == null && this.beanFactory.isSingleton(this.targetBeanName)) {
			// Eagerly fetch singleton target bean, and determine result type. 
			Object bean = this.beanFactory.getBean(this.targetBeanName);
			this.targetBeanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(bean);
			this.resultType = this.targetBeanWrapper.getPropertyType(this.propertyPath);
		} 
	} 
 
 
	@Override 
	public Object getObject() throws BeansException {
		BeanWrapper target = this.targetBeanWrapper;
		if (target != null) {
			if (logger.isWarnEnabled() && this.targetBeanName != null &&
					this.beanFactory instanceof ConfigurableBeanFactory &&
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getBean
 */ 
public class SpringBeanPreparerFactory extends AbstractSpringPreparerFactory { 
 
	@Override 
	protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException { 
		return context.getBean(name, ViewPreparer.class); 
	} 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getBean
 */ 
public class SpringBeanPreparerFactory extends AbstractSpringPreparerFactory { 
 
	@Override 
	protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException { 
		return context.getBean(name, ViewPreparer.class); 
	} 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getBean
			this.targetBeanName = targetBeanName;
		} 
 
		@Override 
		public Object get() throws BeansException {
			return this.beanFactory.getBean(this.targetBeanName);
		} 
	} 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getBean
	} 
 
 
	@Override 
	public Object getTargetObject() {
		return this.beanFactory.getBean(this.targetBeanName);
	} 
 
	@Override 
	public void removeFromScope() { 
		this.beanFactory.destroyScopedBean(this.targetBeanName);
	} 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getBean
		if (logger.isDebugEnabled()) { 
			logger.debug("Using PersistenceManagerFactory '" + getPersistenceManagerFactoryBeanName() + 
					"' for OpenPersistenceManagerInViewFilter"); 
		} 
		WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); 
		return wac.getBean(getPersistenceManagerFactoryBeanName(), PersistenceManagerFactory.class); 
	} 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Spring Framework BeanFactory Methods: