In CDI there is the @ApplicationScoped
and the (javax.inject
) @Singleton
pseudo-scope. What is the difference between them? Besides the fact that @ApplicationScoped
is proxied, and @Singleton
is not.
Can I just change my @Singleton
bean to @ApplicationScoped
? Can @ApplicationScoped
bean have two (or more) instances?
@Singleton
is not part of the CDI specification. It is part of EJB and javax.inject
(JSR-330). It is not mentioned in the spec what is its behaviour, so you can only rely on what's written in the Weld documentation.