@ApplicationScoped in a cluster

2019-06-20 22:51发布

问题:

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?

回答1:

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.