codeconsole commented on code in PR #15765:
URL: https://github.com/apache/grails-core/pull/15765#discussion_r3502716876


##########
grails-testing-support-core/src/main/groovy/org/grails/testing/GrailsApplicationBuilder.groovy:
##########
@@ -166,11 +167,15 @@ class GrailsApplicationBuilder {
             ((AnnotationConfigRegistry) 
context).register(ClassUtils.forName(it, classLoader))
         }
 
-        def beanFactory = (context.beanFactory as 
DefaultListableBeanFactory).tap {
-            allowBeanDefinitionOverriding = true
-            allowCircularReferences = true
-        }
+        def beanFactory = context.beanFactory as DefaultListableBeanFactory
         prepareContext(context, beanFactory)
+        // Bean definition overriding and circular references default to true 
(the historical Grails
+        // behavior) but can be turned off via the standard spring.main.* 
properties. These are read
+        // after prepareContext so that application.yml (loaded by 
ConfigDataApplicationContextInitializer)
+        // and other property sources are available, and before refresh so the 
values take effect.
+        def environment = context.environment

Review Comment:
   @jdaugherty  Reordered so the environment is initialized and the 
`spring.main.*` flags are set before any bean definitions are registered (and 
before `refresh()`) — they now apply to the whole context lifecycle instead of 
after the fact.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to