Given the code fragment:
Assuming this bean is used only in the code fragment above, how long will the injected Bean instance be available?
Given the code fragment:
Assuming this bean is used only in the code fragment above, how long will the injected Bean instance be available?
In the given code fragment, the Bean instance is injected into the Service class, which is annotated with @SessionScoped. Since there is no specific scope annotation on the Bean class, it defaults to @Dependent scope, meaning the Bean instance will have the same lifecycle as the Service object. Therefore, the injected Bean instance will be available for the lifetime of the Service object, which in this case is tied to the session duration.
Answer D. @Dependent scope is a default scope if none is specified. it means that an object exists to serve exactly one client and has the same lifecycle as the client.