Closed
Description
Effectively that means the controllers with these "request scoped dependencies" become request scoped rather than singleton scoped. dinject will detect this and generate BeanFactory class to match and these will be used by the generated web route.
@Controller
@Path("/req-scoped")
class ReqScopedController {
@Inject
Context context; // inject the Javalin context (so will be treated as request scoped)
@Produces("text/plain")
@Get
String getSimple() {
return context.url();
}
}
For Helidon
@Controller
@Path("/req-scoped")
public class ReqScopedController {
@Inject
ServerRequest request; // inject helidon request
@Inject
ServerResponse response; // inject helidon response
...
}