codeconsole opened a new pull request, #15765:
URL: https://github.com/apache/grails-core/pull/15765

   ## Summary
   
   `GrailsApp` and the unit-test harness `GrailsApplicationBuilder` hardcoded
   `allowBeanDefinitionOverriding(true)` and `allowCircularReferences(true)`. 
This
   silently overrode any value an application set through the standard Spring 
Boot
   properties `spring.main.allow-bean-definition-overriding` and
   `spring.main.allow-circular-references` — so there was no way to turn either 
off.
   
   Both now resolve those properties from the configured environment and 
**default
   to `true`** to preserve Grails' historical behavior (a plain Spring Boot app
   defaults both to `false`). Applications can now opt into stricter startup
   semantics:
   
   ```yaml
   spring:
     main:
       allow-bean-definition-overriding: false
       allow-circular-references: false
   ```
   
   ## Changes
   
   - **grails-core** — `GrailsApp.createApplicationContext()` resolves both 
flags
     from the configured environment (defaulting to `true`).
   - **grails-testing-support-core** — 
`GrailsApplicationBuilder.createMainContext()`
     resolves the same properties, read after configuration data is loaded and
     before `refresh()`.
   - **docs** — new "Bean Definition Overriding and Circular References" 
section in
     the Application class configuration guide.
   - **tests** — `GrailsAppContextOverridingSpec` (grails-core) and
     `GrailsApplicationBuilderContextOverridingSpec` (grails-databinding).
   
   ## Notes
   
   - The default is intentionally `true`. Grails' own bootstrap relies on bean
     definition overriding (the harness re-registers infrastructure beans such 
as
     `internalConfigurationAnnotationProcessor`). The test suite documents that
     disabling overriding makes a Grails context fail fast with
     `BeanDefinitionOverrideException` — which is exactly why the default 
differs
     from Spring Boot's.
   - `GrailsApplicationBuilder` lives in `grails-testing-support-core`, but its 
full
     bootstrap requires the servlet API, so its behavioral test lives in
     `grails-databinding` (which has the servlet API on its test classpath and
     already exercises the builder).
   
   ## Verification
   
   - `./gradlew :grails-core:test :grails-databinding:test
     :grails-testing-support-core:test :grails-fields:test --rerun-tasks` — 
green.
   - `checkstyleMain`/`codenarcMain` + `checkstyleTest`/`codenarcTest` on the
     changed modules — no violations.
   


-- 
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