Fixing NPE in AbstractNamedValueMethodArgumentResolver
See gh-23882
This commit is contained in:
committed by
Rossen Stoyanchev
parent
fd9678833f
commit
64f2beb9bf
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.handler.annotation.ValueConstants;
|
||||
@@ -72,10 +73,10 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle
|
||||
* @param beanFactory a bean factory for resolving {@code ${...}}
|
||||
* placeholders and {@code #{...}} SpEL expressions in default values
|
||||
*/
|
||||
protected AbstractNamedValueMethodArgumentResolver(ConversionService conversionService,
|
||||
protected AbstractNamedValueMethodArgumentResolver(@Nullable ConversionService conversionService,
|
||||
@Nullable ConfigurableBeanFactory beanFactory) {
|
||||
|
||||
this.conversionService = conversionService;
|
||||
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(ConversionService conversionService) {
|
||||
public DestinationVariableMethodArgumentResolver(@Nullable ConversionService conversionService) {
|
||||
super(conversionService, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class HeaderMethodArgumentResolver extends AbstractNamedValueMethodArgume
|
||||
|
||||
|
||||
public HeaderMethodArgumentResolver(
|
||||
ConversionService conversionService, @Nullable ConfigurableBeanFactory beanFactory) {
|
||||
@Nullable ConversionService conversionService, @Nullable ConfigurableBeanFactory beanFactory) {
|
||||
|
||||
super(conversionService, beanFactory);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user