Start Up Performance - Explore disabling allow-bean-definition-overriding true by default
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Feature description
Start Up Time Performance can be severely impacted by the following code:
https://github.com/grails/grails-core/blob/1631e8640f4120c00c8c9241b67fb62d698a86ee/grails-core/src/main/groovy/grails/boot/GrailsApp.groovy#L104-L107
I think best practice would be to disable this by default as it hides a lot of duplicate initialization happening behind the scenes with Spring Boot.
For instance, in certain situations I have found when `setAllowBeanDefinitionOverriding(true)` is on, Spring Boot AutoConfigurations are happening that perform various configurations that are later not even used and completely overridden by Grails. The more dependencies that Spring Boot detects in the class path, the greater this penalty can become.
We should explore disabling this by default as it can always be turned on independently [via config](https://docs.spring.io/spring-boot/appendix/application-properties/index.html#application-properties.core.spring.main.allow-bean-definition-overriding) if required by the end user:
```properties
spring.main.allow-bean-definition-overriding=true
```
or
```yml
spring:
main:
allow-bean-definition-overriding: true
```
Contributor guide
Research direction
Start with grails-core/src/main/groovy/grails/boot/GrailsApp.groovy around lines 104-107 and review how setAllowBeanDefinitionOverriding(true) interacts with Spring Boot configuration. Compare startup behavior with overriding enabled and disabled, including applications with dependencies that trigger auto-configuration. Done means determining whether the default can be changed without breaking expected Grails behavior and documenting the required configuration override.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, spring-boot
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100