I have an annotated method @Producesthat creates Apple.
When I use it with @ApplicationScoped, like this
public class AppleProducer {
@ApplicationScoped
@Produces
public Apple createApple() {
return new Apple();
}
}
then Apple is created only once for the entire application.
When I use it with @RequestScoped, like this
public class AppleProducer {
@RequestScoped
@Produces
public Apple createApple() {
return new Apple();
}
}
then it is created for each request.
But what if I do not indicate the scope?
public class AppleProducer {
@Produces
public Apple createApple() {
return new Apple();
}
}
How often will Apple be created? I suspect with every access, is this correct? Is there any documentation on this?
source
share