[JBoss JIRA] (CDI-473) Standardize eager initialisation of ApplicationScoped bean
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-473?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand updated CDI-473:
-------------------------------------
Fix Version/s: TBD
(was: 2.0 .Final)
> Standardize eager initialisation of ApplicationScoped bean
> ----------------------------------------------------------
>
> Key: CDI-473
> URL: https://issues.jboss.org/browse/CDI-473
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Contexts
> Reporter: Antonin Stefanutti
> Fix For: TBD
>
>
> Given the proxying strategy documented in the CDI specification, normal scoped beans get initialize when an injected proxy reference is first called.
> While that's perfectly fine in the vast majority of use cases, that proves inconvenient when dealing with {{ApplicationScoped}} beans that capture application singletons which we want to bound to the application lifecycle with a {{postConstruct}} callback. As this callback is only called when a proxy is invoked, it is frequent to see the application developers using a CDI extension to meet that need, e.g.:
> {code}
> void forceInitialization(@Observes AfterDeploymentValidation adv, BeanManager manager) {
> for (AnnotatedType<?> type : eagerBeans)
> // Calling toString is necessary to force the initialization of normal-scoped beans
> BeanManagerHelper.getReferencesByType(manager, type.getBaseType(), AnyLiteral.INSTANCE).toString();
> }
> {code}
> There should be a concise way to declare that intent which would then be address by the CDI container, for example:
> {code}
> @ApplicationScoped(eager = true}
> class EagerApplicationScopedBean {
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (CDI-226) Clarify the @Singleton behaviour
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-226?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand updated CDI-226:
-------------------------------------
Fix Version/s: 2.1 (Discussion)
(was: 2.0 (discussion))
> Clarify the @Singleton behaviour
> --------------------------------
>
> Key: CDI-226
> URL: https://issues.jboss.org/browse/CDI-226
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Contexts
> Affects Versions: 1.1.EDR
> Reporter: Daniel Sachse
> Labels: F2F2016, application-scoped, singleton
> Fix For: 2.1 (Discussion)
>
>
> The specification should make a more clear statement about the Scope and Lifecycle of the @Singleton annotation.
> ATM it is e.g. totally unclear, in which environment a Singleton is guaranteed to be a Singleton(JVM, EAR, WAR,... ).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (CDI-226) Clarify the @Singleton behaviour
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-226?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand commented on CDI-226:
------------------------------------------
During EG F2F 2016 we launch the idea of writing a mention about singleton saying its discourage in EE.
This said it can be postponed to 2.1
> Clarify the @Singleton behaviour
> --------------------------------
>
> Key: CDI-226
> URL: https://issues.jboss.org/browse/CDI-226
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Contexts
> Affects Versions: 1.1.EDR
> Reporter: Daniel Sachse
> Labels: F2F2016, application-scoped, singleton
> Fix For: 2.0 (discussion)
>
>
> The specification should make a more clear statement about the Scope and Lifecycle of the @Singleton annotation.
> ATM it is e.g. totally unclear, in which environment a Singleton is guaranteed to be a Singleton(JVM, EAR, WAR,... ).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (CDI-437) The container cannot use the final value of AfterTypeDiscovery.getAlternatives() properly
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-437?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-437:
----------------------------------
For the record, Weld 3 currently tries to solve this problem in a way that if {{AfterTypeDiscovery.getAlternatives().add()}} is used a "sythetic" priority is assigned to the "list item". See also {{org.jboss.weld.bootstrap.enablement.EnablementListView.getPriority(Item, Item)}} for details.
> The container cannot use the final value of AfterTypeDiscovery.getAlternatives() properly
> -----------------------------------------------------------------------------------------
>
> Key: CDI-437
> URL: https://issues.jboss.org/browse/CDI-437
> Project: CDI Specification Issues
> Issue Type: Clarification
> Affects Versions: 1.2.Final
> Reporter: Martin Kouba
> Priority: Minor
> Labels: F2F2016
> Fix For: 2.1 (Discussion)
>
>
> {quote}
> Any observer of this event is permitted to add classes to, or remove classes from, the list of alternatives, list of interceptors or list of decorators. *The container must use the final values of these collections*, after all observers of AfterTypeDiscovery have been called, to determine the order of the enabled alternatives, interceptors, and decorators for application. The initial values of these collections are defined by the @Priority annotation.
> {quote}
> However, the container cannot use the final value of the alternatives collection properly. The problem occurs if an extension adds an alternative class.
> The container can either:
> * use the index from the list -> selected alternatives with the same priority will not cause {{AmbiguousResolutionException}} (this contradicts the spec), or
> * use the original priority, an alternative added by an extension will be selected for an application but without any priority value (this contradicts the spec) -> an extension would not be able to affect the final ordering
> The first option seems to be less harmful.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (CDI-229) introduce @OverridesAttribute for @StereoType
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-229?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand updated CDI-229:
-------------------------------------
Fix Version/s: 2.1 (Discussion)
(was: 2.0 (discussion))
> introduce @OverridesAttribute for @StereoType
> ---------------------------------------------
>
> Key: CDI-229
> URL: https://issues.jboss.org/browse/CDI-229
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 1.1.EDR
> Reporter: Mark Struberg
> Fix For: 2.1 (Discussion)
>
>
> We recently had a thread on the DeltaSpike list about using StereoTypes in real world applications: http://markmail.org/thread/ntqwnsyukjvdwspm
> ------
> Imagine the following Stereotype for my Services (I spare out the standard
> stuff)
> @StereoType @Secured @Transactional @ApplicationScoped
> public @interface @Service {}
> The problem here is that there is no way to 'propagate' any rolesAllowed from
> @Service to @Secured, etc.
> What I'd like to have is something like ...
> public @interface @Service {
> String[] rolesAllowed();
> TransactionAttributeType transactionType();
> }
> where the rolesAllowed() would get propagated to the @Secured meta-annotation
> and transactionType() to the @Transactional
> -----------
> Gerhard Petracek now pointed me to a cool feature which is used in JSR-303 BVAL: @OverridesAttribute
> http://docs.oracle.com/javaee/6/api/javax/validation/OverridesAttribute.html
> We should ping the BVAL EG for the details. There are quite a few little tricks and side effects to consider.
> On the implementation side, we could e.g. pick the @StereoType annotation and automatically propagate those values to the AnnotatedType which get's passed to the Extensions
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (CDI-234) behavior of arrays without @Nonbinding
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-234?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand updated CDI-234:
-------------------------------------
Fix Version/s: TBD
(was: 2.0 (discussion))
> behavior of arrays without @Nonbinding
> --------------------------------------
>
> Key: CDI-234
> URL: https://issues.jboss.org/browse/CDI-234
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Concepts
> Affects Versions: 1.0
> Reporter: Romain Manni-Bucau
> Assignee: Pete Muir
> Priority: Minor
> Fix For: TBD
>
>
> The spec says:
> "Array-valued or annotation-valued members of a qualifier type should be annotated @Nonbinding in a portable application.
> If an array-valued or annotation-valued member of a qualifier type is not annotated @Nonbinding, non-portable behavior
> results."
> The case of arrays without this annotation should be managed to get a better portability. The equality of arrays is determined through "Arrays" helper (http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Annotat...) so i don't think there is any technical issue to consider arrays as a field.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months