I don't have a clustered environment at present, but I was curious about @ApplicationScoped behaviour in a clustered environment. Is there going to be only one across the cluster or is still still one per JVM in the cluster?
I have read that @Singleton gets created per JVM in
How singleton is javax.ejb.Singleton in a clustered environment?
@ApplicationScoped beans are not replicated per se.
There may be some containers or servers replicating those beans, but it is not part of the CDI spec. By default, the beans are not shared across JVMs. CDI will create one unique proxy per cluster member / jvm.
The part of Jakarta EE that is designed to handle this (by specification), is EJB.
References to @ApplicationScoped are proxied, so they will be correctly resolved by the CDI container. That holds true no matter how many nodes are present within the application; the state and instance is shared across all client requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With