提交 005d2018 编写于 作者: R Rossen Stoyanchev

Refine changes for PR

Closes gh-23882
上级 64f2beb9
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册