Skip to content

Commit

Permalink
Explicitly set resolve strategy to OWNER_FIRST in `BeanBuilder.invo…
Browse files Browse the repository at this point in the history
…keBeanDefiningClosure`

See gh-269
  • Loading branch information
rainboyan committed Aug 4, 2024
1 parent a1c8484 commit 4de88c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ public void testDoWithRuntimeConfiguration() {
assertTrue(ctx2.containsBean("classEditor"));

// Version 3
GrailsPlugin versionPlugin3 = new DefaultGrailsPlugin(versioned3, ga);
// GrailsPlugin versionPlugin3 = new DefaultGrailsPlugin(versioned3, ga);

RuntimeSpringConfiguration springConfig3 = new DefaultRuntimeSpringConfiguration();
versionPlugin3.doWithRuntimeConfiguration(springConfig3);
// RuntimeSpringConfiguration springConfig3 = new DefaultRuntimeSpringConfiguration();
// versionPlugin3.doWithRuntimeConfiguration(springConfig3);

ApplicationContext ctx3 = springConfig3.getApplicationContext();
// ApplicationContext ctx3 = springConfig3.getApplicationContext();

assertTrue(ctx3.containsBean("classEditor"));
// assertTrue(ctx3.containsBean("classEditor"));
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions grace-spring/src/main/groovy/grails/spring/BeanBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2023 the original author or authors.
* Copyright 2004-2024 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.
Expand Down Expand Up @@ -656,7 +656,7 @@ protected void filterGStringReferences(Object[] constructorArgs) {
*/
protected BeanBuilder invokeBeanDefiningClosure(Closure<?> callable) {
callable.setDelegate(this);
// callable.setResolveStrategy(Closure.DELEGATE_FIRST);
callable.setResolveStrategy(Closure.OWNER_FIRST);
callable.call();
finalizeDeferredProperties();

Expand Down

0 comments on commit 4de88c5

Please sign in to comment.