Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start Up Performance - Explore disabling allow-bean-definition-overriding true by default #13827

Open
codeconsole opened this issue Nov 8, 2024 · 1 comment

Comments

@codeconsole
Copy link
Contributor

Feature description

Start Up Time Performance can be severely impacted by the following code:

protected ConfigurableApplicationContext createApplicationContext() {
setAllowBeanDefinitionOverriding(true)
setAllowCircularReferences(true)
ConfigurableApplicationContext applicationContext = super.createApplicationContext()

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 if required by the end user:

spring.main.allow-bean-definition-overriding=true

or

spring:
  main:
    allow-bean-definition-overriding: true
@codeconsole
Copy link
Contributor Author

allow-circular-references is also something that should be considered off by default due to it promotes bad design by resulting in a tightly coupled application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant