RESOLVED - issue BATCH-1058: PlaceholderTargetSource doesn't always replace all placeholders
This commit is contained in:
@@ -177,7 +177,7 @@ public class PlaceholderTargetSource extends SimpleBeanTargetSource implements I
|
||||
BeanWrapper wrapper = new BeanWrapperImpl(contextFactory.getContext());
|
||||
if (wrapper.isReadableProperty(key)) {
|
||||
Object property = wrapper.getPropertyValue(key);
|
||||
if (property==null || requiredType.isAssignableFrom(property.getClass())) {
|
||||
if (property == null || requiredType.isAssignableFrom(property.getClass())) {
|
||||
result = property;
|
||||
}
|
||||
}
|
||||
@@ -218,9 +218,8 @@ public class PlaceholderTargetSource extends SimpleBeanTargetSource implements I
|
||||
// here.
|
||||
// replaceIfTypeMatches(result, first, next, key, Date.class,
|
||||
// typeConverter);
|
||||
|
||||
first = result.indexOf(PLACEHOLDER_PREFIX, next + 1);
|
||||
next = result.indexOf(PLACEHOLDER_SUFFIX, first + 1);
|
||||
first = result.indexOf(PLACEHOLDER_PREFIX, first + 1);;
|
||||
next = result.indexOf(PLACEHOLDER_SUFFIX, first + 1);;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@ public class PlaceholderTargetSourceTests extends ContextFactorySupport {
|
||||
@Qualifier("withInteger")
|
||||
private PlaceholderTargetSource withInteger;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("withMultiple")
|
||||
private PlaceholderTargetSource withMultiple;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("withDate")
|
||||
private PlaceholderTargetSource withDate;
|
||||
@@ -144,6 +148,12 @@ public class PlaceholderTargetSourceTests extends ContextFactorySupport {
|
||||
assertEquals("bar-4321", target.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMultiple() {
|
||||
Node target = (Node) withMultiple.getTarget();
|
||||
assertEquals("bar-4321-4321", target.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDate() {
|
||||
Node target = (Node) withDate.getTarget();
|
||||
|
||||
@@ -48,6 +48,12 @@
|
||||
<property name="targetBeanName" value="withIntegerTarget" />
|
||||
</bean>
|
||||
|
||||
<bean id="withMultiple"
|
||||
class="org.springframework.batch.core.scope.util.PlaceholderTargetSource">
|
||||
<property name="contextFactory" ref="context" />
|
||||
<property name="targetBeanName" value="withMultipleTarget" />
|
||||
</bean>
|
||||
|
||||
<bean id="withDate"
|
||||
class="org.springframework.batch.core.scope.util.PlaceholderTargetSource">
|
||||
<property name="contextFactory" ref="context" />
|
||||
@@ -98,6 +104,12 @@
|
||||
<property name="name" value="bar-#{integer}" />
|
||||
</bean>
|
||||
|
||||
<bean id="withMultipleTarget"
|
||||
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
|
||||
lazy-init="true">
|
||||
<property name="name" value="bar-#{integer}-#{integer}" />
|
||||
</bean>
|
||||
|
||||
<bean id="withDateTarget"
|
||||
class="org.springframework.batch.core.scope.util.PlaceholderTargetSourceTests$Foo"
|
||||
lazy-init="true">
|
||||
|
||||
Reference in New Issue
Block a user