parent
64f2beb9bf
commit
005d2018d4
|
|
@ -73,10 +73,16 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle
|
|||
* @param beanFactory a bean factory for resolving {@code ${...}}
|
||||
* placeholders and {@code #{...}} SpEL expressions in default values
|
||||
*/
|
||||
protected AbstractNamedValueMethodArgumentResolver(@Nullable ConversionService conversionService,
|
||||
protected AbstractNamedValueMethodArgumentResolver(ConversionService conversionService,
|
||||
@Nullable ConfigurableBeanFactory beanFactory) {
|
||||
|
||||
this.conversionService = conversionService != null ? conversionService : DefaultConversionService.getSharedInstance();
|
||||
// Fallback on shared ConversionService for now for historic reasons.
|
||||
// Possibly remove after discussion in gh-23882.
|
||||
|
||||
//noinspection ConstantConditions
|
||||
this.conversionService = conversionService != null ?
|
||||
conversionService : DefaultConversionService.getSharedInstance();
|
||||
|
||||
this.configurableBeanFactory = beanFactory;
|
||||
this.expressionContext = (beanFactory != null ? new BeanExpressionContext(beanFactory, null) : null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class DestinationVariableMethodArgumentResolver extends AbstractNamedValu
|
|||
DestinationVariableMethodArgumentResolver.class.getSimpleName() + ".templateVariables";
|
||||
|
||||
|
||||
public DestinationVariableMethodArgumentResolver(@Nullable ConversionService conversionService) {
|
||||
public DestinationVariableMethodArgumentResolver(ConversionService conversionService) {
|
||||
super(conversionService, null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class HeaderMethodArgumentResolver extends AbstractNamedValueMethodArgume
|
|||
|
||||
|
||||
public HeaderMethodArgumentResolver(
|
||||
@Nullable ConversionService conversionService, @Nullable ConfigurableBeanFactory beanFactory) {
|
||||
ConversionService conversionService, @Nullable ConfigurableBeanFactory beanFactory) {
|
||||
|
||||
super(conversionService, beanFactory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,14 +145,6 @@ public class HeaderMethodArgumentResolverTests {
|
|||
assertThat(result).isEqualTo(Optional.of("bar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveOptionalHeaderWithValueFromNullConversionServiceInput() throws Exception {
|
||||
GenericApplicationContext context = new GenericApplicationContext();
|
||||
context.refresh();
|
||||
resolver = new HeaderMethodArgumentResolver(null, context.getBeanFactory());
|
||||
resolveOptionalHeaderWithValue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveOptionalHeaderAsEmpty() throws Exception {
|
||||
Message<String> message = MessageBuilder.withPayload("foo").build();
|
||||
|
|
|
|||
Loading…
Reference in New Issue