master
Juergen Hoeller 12 years ago
parent e5d9378482
commit 575926932d
  1. 5
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
  2. 4
      spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
  3. 5
      spring-core/src/main/java/org/springframework/core/env/PropertiesPropertySource.java

@ -746,7 +746,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
public String resolveEmbeddedValue(String value) {
String result = value;
for (StringValueResolver resolver : this.embeddedValueResolvers) {
result = (result == null ? null : resolver.resolveStringValue(result));
if (result == null) {
return null;
}
result = resolver.resolveStringValue(result);
}
return result;
}

@ -277,14 +277,14 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
for (String beanName : beanNames) {
T beanInstance = getBean(beanName, requiredType);
if (isPrimary(beanName, beanInstance)) {
if(primaryBean != null) {
if (primaryBean != null) {
throw new NoUniqueBeanDefinitionException(requiredType, beanNames.length,
"more than one 'primary' bean found of required type: " + Arrays.asList(beanNames));
}
primaryBean = beanInstance;
}
}
if(primaryBean != null) {
if (primaryBean != null) {
return primaryBean;
}
throw new NoUniqueBeanDefinitionException(requiredType, beanNames);

@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,13 +31,12 @@ import java.util.Properties;
*
* @author Chris Beams
* @since 3.1
* @see org.springframework.mock.env.MockPropertySource
*/
public class PropertiesPropertySource extends MapPropertySource {
@SuppressWarnings({ "unchecked", "rawtypes" })
public PropertiesPropertySource(String name, Properties source) {
super(name, (Map)source);
super(name, (Map) source);
}
}

Loading…
Cancel
Save