Skip to content

Using @Startup with @Produces methods #49069

Answered by Ladicek
julianhowarth asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think you have the right mental model.

once wiring is complete

Normal scoped beans (such as @ApplicationScoped or @RequestScoped) are never injected directly. A client proxy is injected instead, which forwards invocations to the correct instance, and that instance is created lazily. So you cannot really say that "wiring is complete before startup", unless all your beans are @Singleton or @Dependent.

(Note that this depends on what you mean by "wiring", which might be different from my understanding of the term.)

startup events are fired which observers can act upon (e.g. startup or postconstruct annotated)

You cannot mix @PostConstruct callbacks and startup observers like this…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@julianhowarth
Comment options

@manovotn
Comment options

@julianhowarth
Comment options

@Ladicek
Comment options

Ladicek Jul 24, 2025
Collaborator

Answer selected by julianhowarth
@julianhowarth
Comment options

@manovotn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants