[jboss-jira] [JBoss JIRA] (AS7-5089) ApplicationScoped Object is instantiated twice
andrei povodyrev (JIRA)
jira-events at lists.jboss.org
Fri Jun 29 22:08:12 EDT 2012
[ https://issues.jboss.org/browse/AS7-5089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704052#comment-12704052 ]
andrei povodyrev commented on AS7-5089:
---------------------------------------
I am sorry. I might have not explained it specifically enough. I am not creating explicitly any instances. The object is injected and is managed by Weld exclusively. However when the Restful end point is instantiated, EventService.java, which is injected with the @ApplicationScoped EventCache, EventCache is instantiated twice as can be seen in the logs - there is System.out in the constructor.
ApplicationScoped object should have only one instance per CDI context. This is per the spec. Is not it?
Please check the attached project source. It is a slight modification from a quickstart project distributed with Jboss Developer Studio. I would like to reopen the ticket.
> 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