[
https://issues.apache.org/jira/browse/ONAMI-115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nick Merlo reopened ONAMI-115:
------------------------------
Apologies for re-opening this issue, but there seems to be a second aspect to
this problem. In the PersistenceFilterImpl class, an instance of
AllPersistenceUnits is injected into the class. While this class has a
singleton scope annotation, it is not explicitly bound.
The PersistModule does bind an instance of this class for the interfaces
AllPersistenceServices and AllUnitsOfWork. However, the lack of a binding for
AllPersistenceUnits causes guice to create a new instance when injecting into
the PersistFilterImpl. This new instance does not contain the configured
persist services or units of work meaning the persist filter does not function
correctly.
The simple solution seems to be to include an additional binding for the
AllPersistenceUnits class. Adding the following line in the PersistModule
seems to fix the problem.
bind(AllPersistenceUnits.class).toInstance(allPersistenceUnits)
This ensures that the same instance is injected into the filter
> PersistenceFilter should be bound in Singleton scope
> ----------------------------------------------------
>
> Key: ONAMI-115
> URL: https://issues.apache.org/jira/browse/ONAMI-115
> Project: Apache Onami
> Issue Type: Bug
> Affects Versions: persist-1.0.0
> Reporter: Nick Merlo
> Assignee: Stephan Classen
> Fix For: persist-1.0.1
>
>
> Guice's servlet module requires that Filter classes be bound in the singleton
> scope. PersistenceFilter is currently not bound into such a scope which
> causes an exception to be thrown during initialization
> The binding should be bound into the scope either in PersistenceModule or by
> annotating the PersistenceFilterImpl class with @Singleton
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)