Skip to content

Commit cb64dd1

Browse files
committed
StandardTypeConverter initializes default ConversionService against volatile field
Issue: SPR-14465 (cherry picked from commit 97d73eb)
1 parent c38381a commit cb64dd1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
3636
*/
3737
public class StandardTypeConverter implements TypeConverter {
3838

39-
private static ConversionService defaultConversionService;
39+
private static volatile ConversionService defaultConversionService;
4040

4141
private final ConversionService conversionService;
4242

@@ -45,10 +45,8 @@ public class StandardTypeConverter implements TypeConverter {
4545
* Create a StandardTypeConverter for the default ConversionService.
4646
*/
4747
public StandardTypeConverter() {
48-
synchronized (this) {
49-
if (defaultConversionService == null) {
50-
defaultConversionService = new DefaultConversionService();
51-
}
48+
if (defaultConversionService == null) {
49+
defaultConversionService = new DefaultConversionService();
5250
}
5351
this.conversionService = defaultConversionService;
5452
}

0 commit comments

Comments
 (0)