RESOLVED - issue BATCH-1397: Late binding only happens once per ApplicationContext if expression is in substring
http://jira.springframework.org/browse/BATCH-1397
This commit is contained in:
@@ -330,7 +330,7 @@ public class PlaceholderTargetSource extends SimpleBeanTargetSource implements I
|
||||
// Otherwise it might contain embedded keys so we try to
|
||||
// replace those
|
||||
String visitedString = resolveStringValue(stringValue);
|
||||
typedStringValue.setValue(visitedString);
|
||||
value = new TypedStringValue(visitedString);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,10 @@ public class MultipleContextPlaceholderTargetSourceTests {
|
||||
@Qualifier("simple")
|
||||
private TestBean simple;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("nested")
|
||||
private TestBean nested;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("list")
|
||||
private TestBean list;
|
||||
@@ -88,6 +92,17 @@ public class MultipleContextPlaceholderTargetSourceTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleNestedValueFromProperties() throws Exception {
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
final String value = "bar" + i;
|
||||
attributes = Collections.singletonMap("foo", value);
|
||||
assertEquals("foo-bar" + i, nested.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleValueInList() throws Exception {
|
||||
|
||||
|
||||
@@ -16,6 +16,16 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="nested" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="targetSource">
|
||||
<bean
|
||||
class="org.springframework.batch.core.scope.util.PlaceholderTargetSource">
|
||||
<property name="contextFactory" ref="context" />
|
||||
<property name="targetBeanName" value="nestedTarget" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="list" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="targetSource">
|
||||
<bean
|
||||
@@ -41,6 +51,11 @@
|
||||
<property name="name" value="%{attributes[foo]}" />
|
||||
</bean>
|
||||
|
||||
<bean id="nestedTarget"
|
||||
class="org.springframework.batch.core.scope.util.MultipleContextPlaceholderTargetSourceTests$TestBean">
|
||||
<property name="name" value="foo-%{attributes[foo]}" />
|
||||
</bean>
|
||||
|
||||
<bean id="listTarget"
|
||||
class="org.springframework.batch.core.scope.util.MultipleContextPlaceholderTargetSourceTests$TestBean">
|
||||
<property name="names">
|
||||
|
||||
Reference in New Issue
Block a user