@@ -115,12 +115,6 @@ public void setConstructorResolvers(List<ConstructorResolver> constructorResolve
115115 this .constructorResolvers = constructorResolvers ;
116116 }
117117
118- private void ensureConstructorResolversInitialized () {
119- if (this .constructorResolvers == null ) {
120- this .constructorResolvers = new ArrayList <ConstructorResolver >();
121- this .constructorResolvers .add (new ReflectiveConstructorResolver ());
122- }
123- }
124118
125119 public void addMethodResolver (MethodResolver resolver ) {
126120 ensureMethodResolversInitialized ();
@@ -149,12 +143,6 @@ public void setMethodResolvers(List<MethodResolver> methodResolvers) {
149143 this .methodResolvers = methodResolvers ;
150144 }
151145
152- private void ensureMethodResolversInitialized () {
153- if (this .methodResolvers == null ) {
154- this .methodResolvers = new ArrayList <MethodResolver >();
155- this .methodResolvers .add (reflectiveMethodResolver =new ReflectiveMethodResolver ());
156- }
157- }
158146
159147 public void addPropertyAccessor (PropertyAccessor accessor ) {
160148 ensurePropertyAccessorsInitialized ();
@@ -174,12 +162,6 @@ public void setPropertyAccessors(List<PropertyAccessor> propertyAccessors) {
174162 this .propertyAccessors = propertyAccessors ;
175163 }
176164
177- private void ensurePropertyAccessorsInitialized () {
178- if (this .propertyAccessors == null ) {
179- this .propertyAccessors = new ArrayList <PropertyAccessor >();
180- this .propertyAccessors .add (new ReflectivePropertyAccessor ());
181- }
182- }
183165
184166 public void setTypeLocator (TypeLocator typeLocator ) {
185167 Assert .notNull (typeLocator , "TypeLocator must not be null" );
@@ -252,4 +234,46 @@ public void registerMethodFilter(Class<?> type, MethodFilter filter) {
252234 reflectiveMethodResolver .registerMethodFilter (type ,filter );
253235 }
254236
237+ private void ensurePropertyAccessorsInitialized () {
238+ if (this .propertyAccessors == null ) {
239+ initializePropertyAccessors ();
240+ }
241+ }
242+
243+ private synchronized void initializePropertyAccessors () {
244+ if (this .propertyAccessors == null ) {
245+ List <PropertyAccessor > defaultAccessors = new ArrayList <PropertyAccessor >();
246+ defaultAccessors .add (new ReflectivePropertyAccessor ());
247+ this .propertyAccessors = defaultAccessors ;
248+ }
249+ }
250+
251+ private void ensureMethodResolversInitialized () {
252+ if (this .methodResolvers == null ) {
253+ initializeMethodResolvers ();
254+ }
255+ }
256+
257+ private synchronized void initializeMethodResolvers () {
258+ if (this .methodResolvers == null ) {
259+ List <MethodResolver > defaultResolvers = new ArrayList <MethodResolver >();
260+ defaultResolvers .add (reflectiveMethodResolver = new ReflectiveMethodResolver ());
261+ this .methodResolvers = defaultResolvers ;
262+ }
263+ }
264+
265+ private void ensureConstructorResolversInitialized () {
266+ if (this .constructorResolvers == null ) {
267+ initializeConstructorResolvers ();
268+ }
269+ }
270+
271+ private synchronized void initializeConstructorResolvers () {
272+ if (this .constructorResolvers == null ) {
273+ List <ConstructorResolver > defaultResolvers = new ArrayList <ConstructorResolver >();
274+ defaultResolvers .add (new ReflectiveConstructorResolver ());
275+ this .constructorResolvers = defaultResolvers ;
276+ }
277+ }
278+
255279}
0 commit comments