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

feat: make adding a main application optional #91

Merged
merged 3 commits into from
Jul 30, 2021
Merged

Conversation

metacosm
Copy link
Member

Since most operator applications don't really need to do anything in the
main method besides calling start on Operator, make it possible to not
provide a QuarkusApplication at all, thus removing more boilerplate.

Since most operator applications don't really need to do anything in the
main method besides calling `start` on Operator, make it possible to not
provide a `QuarkusApplication` at all, thus removing more boilerplate.
@metacosm metacosm self-assigned this Jul 30, 2021
Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


// if the app doesn't provide a main class, add the StartupListener
if (index.getAllKnownImplementors(DotName.createSimple(QuarkusApplication.class.getName())).isEmpty()) {
additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(StartupListener.class));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, you might want to add the scope here, which is likely @Singleton

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add the scope on the class or add it when the bean is produced?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are conditionally registering it as a bean, I propose doing it here

@metacosm metacosm force-pushed the add-startup-listener branch from 136b8ee to 7ae4cc7 Compare July 30, 2021 14:18
@metacosm metacosm merged commit bb3eb8a into main Jul 30, 2021
@metacosm metacosm deleted the add-startup-listener branch July 30, 2021 14:26
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.

2 participants