[jboss-jira] [JBoss JIRA] (AS7-5089) ApplicationScoped Object is instantiated twice
Stuart Douglas (JIRA)
jira-events at lists.jboss.org
Fri Jun 29 16:11:13 EDT 2012
[ https://issues.jboss.org/browse/AS7-5089?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stuart Douglas resolved AS7-5089.
---------------------------------
Resolution: Rejected
This is the expected behaviour, as @ApplicationScoped is a normal scoped object, it is proxied, and as such the constructor gets called when the proxy is created.
As per the specification you should do initialization in a @PostConstruct method, rather than the constructor (same applied to EJB's etc).
> ApplicationScoped Object is instantiated twice
> ----------------------------------------------
>
> Key: AS7-5089
> URL: https://issues.jboss.org/browse/AS7-5089
> Project: Application Server 7
> Issue Type: Bug
> Components: CDI / Weld, REST
> Affects Versions: 7.1.2.Final (EAP)
> Environment: windows 7, rhel 6.1
> Reporter: andrei povodyrev
> Assignee: Stuart Douglas
> Attachments: jboss-javaee6-webapp.zip
>
>
> Using the jboss-javaee6-webapp quickstart project
> Created EventCache ApplicationScoped object
> Injected into EventService Rest endpoint
> Deployed to EAP6 using JDStudio
> pointed browser to http://localhost:8080/jboss-javaee6-webapp/rest/events
> As can be seen from the logs EventCache object is instantiated 2 times
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list