Following class
public class MaskHolder {
private Mask mask;
private UUID id = UUID.randomUUID()
void store() {
System.out.println(id);
}
public void get() {
System.out.println(id);
}
}
is bound to HK2 like this
bind(MaskHolder.class).to(MaskHolder.class)
.proxy(true).proxyForSameScope(false).in(RequestScoped.class);
Proxy injected to bean with @Context behaves as expected for public method but executes package-private method as well. The problem is package-private method does not trigger MethodInterceptor so it actually does not reach the same instance get() does. The question is what is this "default" instance to which proxy forwards package-private method call. Calling get() method I reach different instance on different requests but calling store method ends up in the same instance every time so it behaves like singleton.