[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jersey-dev] Proxies for same scope?
|
Jersey version 2.30.1 BTW.
On Wed, Mar 24, 2021 at 6:14 PM Martynas Jusevičius
<martynas@xxxxxxxxxxxxx> wrote:
>
> Hi,
>
> I have a binder which shouldn't be using proxies for request-scoped resources:
>
> register(new AbstractBinder()
> {
> @Override
> protected void configure()
> {
>
> bindFactory(ApplicationFactory.class).to(com.atomgraph.linkeddatahub.apps.model.Application.class).
> proxy(true).proxyForSameScope(false).
> in(RequestScoped.class);
> }
> });
>
> And then I have 2 types of resource classes that inject that Application class:
>
> @Inject com.atomgraph.linkeddatahub.apps.model.Application application
>
> 1. resource class that gets matched by explicit @Path -- Application
> is injected as my ApplicationImpl, as expected
> 2. resource class that gets returned by a sub-resource method --
> Application is injected as a proxy object. Why?!
>
> I made sure the sub-resource method returns a class and not an
> instance, based on the documentation below, thinking this would help
> Jersey figure out the life-cycle. But that did not make a difference
> -- I still get proxies injected.
> https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/jaxrs-resources.html#d0e2641
>
> Does anyone have any clues? I think I would be able to create a
> reproducible example, but I'd rather not unless absolutely necessary
> :)
>
> Thanks.
>
> Martynas
> atomgraph.com