Skip to content

Commit

Permalink
Refine changes for PR
Browse files Browse the repository at this point in the history
Closes gh-23882
  • Loading branch information
rstoyanchev committed Oct 31, 2019
1 parent 64f2beb commit 005d201
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ public void resolveOptionalHeaderWithValue() throws Exception {
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();
Expand Down

0 comments on commit 005d201

Please sign in to comment.