-
Notifications
You must be signed in to change notification settings - Fork 39
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
[Bug]: ScheuledExecutorService not work in @PostConstruct bean lifecycle hook #656
Comments
A There might be a bug somewhere else, such as the CDI implementation, but I would guess the more likely cause is a wrong expectation. PostConstruct should be invoked after an instance of the bean is constructed, which might not happen until you invoke a method on it, which defeats the purpose of having it automatically trigger something to happen at application startup. You might want to consider something else, like,
but that is the domain of the CDI specification, not Jakarta Concurrency. |
@njr-11 But in the original EJB |
If you have concerns about the design of how |
@njr-11 Can you transfer it to CDI Github issues? |
I don't have authority to do that. I can point you at the github project for CDI and you can open an issue that links back to this one if you like. I'm not going to open it myself because it seems reasonable to me that |
Specification Version
3.1.1
Bug report
I tried to convert the EJB timer-based scheduling work to use CDI and ScheduledExecutorService instead.
The original EJB
@Singleton
beans with a@Startup
annotation.and then convert to the following.
It does not work, there are no exceptions, and no useful information is provided to developers and tell developers what is wrong.
But changed to observing the
Startup
event, and it worked.Additional information
No response
The text was updated successfully, but these errors were encountered: