Shared DefaultConversionService instance for simple fallback purposes

Issue: SPR-14948
This commit is contained in:
Juergen Hoeller
2016-11-24 15:29:17 +01:00
parent 34c6c9ffc2
commit 80931b211c
7 changed files with 82 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public class GenericMessageConverter extends SimpleMessageConverter {
* Create a new instance with a default {@link ConversionService}.
*/
public GenericMessageConverter() {
this.conversionService = new DefaultConversionService();
this.conversionService = DefaultConversionService.getSharedInstance();
}
/**

View File

@@ -76,7 +76,7 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle
* values are not expected to contain expressions
*/
protected AbstractNamedValueMethodArgumentResolver(ConversionService cs, ConfigurableBeanFactory beanFactory) {
this.conversionService = (cs != null ? cs : new DefaultConversionService());
this.conversionService = (cs != null ? cs : DefaultConversionService.getSharedInstance());
this.configurableBeanFactory = beanFactory;
this.expressionContext = (beanFactory != null ? new BeanExpressionContext(beanFactory, null) : null);
}