You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/20 01:57:12 UTC

[james-project] 44/49: [Refactoring] protocols-lmtp should rely on constructor injection

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 ae1ced3e0ded480e4492b96d5d486718b03495f8
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:21:43 2019 +0700

    [Refactoring] protocols-lmtp should rely on constructor injection
---
 .../lmtpserver/hook/MailboxDeliverToRecipientHandler.java  | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java
index bd0205b..74f7d7d 100644
--- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java
+++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/hook/MailboxDeliverToRecipientHandler.java
@@ -47,25 +47,19 @@ import org.slf4j.LoggerFactory;
 
 /**
  * {@link DeliverToRecipientHook} which deliver the message directly to the recipients mailbox.
- * 
- *
  */
 public class MailboxDeliverToRecipientHandler implements DeliverToRecipientHook {
     private static final Logger LOGGER = LoggerFactory.getLogger(MailboxDeliverToRecipientHandler.class);
   
-    private UsersRepository users;
-    private MailboxManager mailboxManager;
+    private final UsersRepository users;
+    private final MailboxManager mailboxManager;
 
     @Inject
-    public final void setUsersRepository(UsersRepository users) {
+    public MailboxDeliverToRecipientHandler(UsersRepository users, @Named("mailboxmanager") MailboxManager mailboxManager) {
         this.users = users;
-    }
-
-    @Inject
-    public final void setMailboxManager(@Named("mailboxmanager") MailboxManager mailboxManager) {
         this.mailboxManager = mailboxManager;
     }
-    
+
     @Override
     public HookResult deliver(SMTPSession session, MailAddress recipient, MailEnvelope envelope) {
         try {


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