You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/12/12 06:13:51 UTC

[james-project] 08/08: JAMES-3754 Fix Guice binding

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 73ab92cf19bd149b9444fb8ffe6ee8ccb86c0884
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Wed Dec 7 13:47:00 2022 +0700

    JAMES-3754 Fix Guice binding
    
    - Spring bean
    - Memory mapper factory injection
---
 mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml     | 2 ++
 .../mailbox/inmemory/InMemoryMailboxSessionMapperFactory.java      | 3 +++
 .../memory/src/main/resources/META-INF/spring/mailbox-memory.xml   | 7 ++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
index 044f1d3a98..e0fa9d0fd8 100644
--- a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
+++ b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
@@ -42,9 +42,11 @@
         <constructor-arg index="7" ref="quotaComponents" />
         <constructor-arg index="8" ref="indexer" />
         <constructor-arg index="9" ref="threadIdGuessingAlgorithm" />
+        <constructor-arg index="10" ref="clock" />
     </bean>
 
     <bean id="threadIdGuessingAlgorithm" class="org.apache.james.mailbox.store.mail.NaiveThreadIdGuessingAlgorithm" />
+    <bean id="clock" class="java.time.Clock" factory-method="systemUTC" />
 
     <bean id ="jpa-subscriptionManager" class="org.apache.james.mailbox.store.StoreSubscriptionManager">
         <constructor-arg index="0" ref="jpa-sessionMapperFactory"/>
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxSessionMapperFactory.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxSessionMapperFactory.java
index c9e384f3bb..37da525571 100644
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxSessionMapperFactory.java
+++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxSessionMapperFactory.java
@@ -20,6 +20,8 @@ package org.apache.james.mailbox.inmemory;
 
 import java.time.Clock;
 
+import javax.inject.Inject;
+
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.inmemory.mail.InMemoryAnnotationMapper;
@@ -51,6 +53,7 @@ public class InMemoryMailboxSessionMapperFactory extends MailboxSessionMapperFac
     private final InMemoryUidProvider uidProvider;
     private final InMemoryModSeqProvider modSeqProvider;
 
+    @Inject
     public InMemoryMailboxSessionMapperFactory(Clock clock) {
         mailboxMapper = new InMemoryMailboxMapper();
         uidProvider = new InMemoryUidProvider();
diff --git a/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml b/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
index a4cf3f9053..9f68609c3b 100644
--- a/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
+++ b/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
@@ -44,6 +44,7 @@
         <constructor-arg index="9" ref="indexer" />
         <constructor-arg index="10" ref="preDeletionHooks" />
         <constructor-arg index="11" ref="threadIdGuessingAlgorithm" />
+        <constructor-arg index="12" ref="clock" />
     </bean>
 
     <bean id ="memory-subscriptionManager" class="org.apache.james.mailbox.store.StoreSubscriptionManager">
@@ -52,8 +53,12 @@
         <constructor-arg index="2" ref="event-bus"/>
     </bean>
 
-    <bean id="memory-sessionMapperFactory" class="org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory" />
+    <bean id="memory-sessionMapperFactory" class="org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory" >
+        <constructor-arg index="0" ref="clock"/>
+    </bean>
+
     <bean id="threadIdGuessingAlgorithm" class="org.apache.james.mailbox.store.mail.NaiveThreadIdGuessingAlgorithm"/>
+    <bean id="clock" class="java.time.Clock" factory-method="systemUTC" />
 
     <alias name="jvm-locker" alias="memory-locker"/>
 


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org