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

Defer fail-fast initialization to ApplicationReadyEvent #431

Merged
merged 1 commit into from Nov 10, 2023

Conversation

tvahrst
Copy link
Contributor

@tvahrst tvahrst commented Nov 4, 2023

This PR introduces a small change to the fail-fast initialization of AsyncApi. Until now, the initialization happend during afterPropertiesSet() method in SpringWolfInitApplicationListener - which means: after the SpringWolfInitApplicationListener bean and all dependents (including AsyncApiService etc...) have been initialized.

The disadvantage of initializing the AsyncAPI at this point of time is, that the spring context isn't completly initialized, some beans may not exist in the spring-context at this moment. This may be problematic if scanner classes will for example make use of BeanPostProcessors or Spring AOP to detect (infrastructre) beans.

I moved the fail-fast initializing branch into the onApplicationEvent() method, which means:

  • the AsyncApi initialization happens a little bit later
  • the fail-fast semantics remains valid, in case of a validation error the spring application will not boot but abort throwing an exception.

…opertiesSet' to onApplicationReadyEvent

Took 17 minutes
Copy link

netlify bot commented Nov 4, 2023

Deploy Preview for springwolf-ui canceled.

Name Link
🔨 Latest commit 96d401f
🔍 Latest deploy log https://app.netlify.com/sites/springwolf-ui/deploys/6545fa645ea7f20008203b94

@sam0r040 sam0r040 merged commit 54d07d7 into springwolf:master Nov 10, 2023
14 checks passed
@sam0r040 sam0r040 deleted the initapplicationlistener-failfast branch November 10, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants