cdi icon indicating copy to clipboard operation
cdi copied to clipboard

Support injection of non-proxyable beans

Open vaadin-bot opened this issue 11 years ago • 2 comments

Originally by @hesara


A @NormalScope (like the current @UIScoped and @ViewScoped) results in the creation of a proxy class by the CDI implementation. This is not possible e.g. when final methods are used.

Alternative versions of @UIScoped and @ViewScoped could be provided that are not @NormalScope but pseudo-scopes. This requires separate contexts for these (overriding getScope()) as well as registering and notifying them in VaadinExtension.

See also http://dev.vaadin.com/ticket/13330#comment:6


Imported from https://dev.vaadin.com/ issue #14717

vaadin-bot avatar Sep 22 '14 07:09 vaadin-bot

Originally by @Legioth


I wouldn't expect this to be such a big issue for anything that is already designed to work with CDI since everyone is (assumably) aware of the issue with final methods. Converting an existing project to use CDI is of course a different issue.

One additional issue with @NormalScope is also the identity problems that we already faced with injected components. Are we aware of any other reasons to use pseudo-scopes?

Can the code implemented for supporting the current scopes be reused for implementing this feature?

vaadin-bot avatar Sep 22 '14 09:09 vaadin-bot

Originally by @hesara


As a workaround for projects that need this, the annotations @UIScoped and @ViewScoped can be copied to the project (keeping them in com.vaadin.cdi) and modified to use @Scope instead of @NormalScope.

This disables interceptors and decorators for classes with these annotations.

vaadin-bot avatar Sep 22 '14 13:09 vaadin-bot