2016-04-27 42 views
0

我試圖使用integration訪問Gmail帳戶。我需要使用Http.inboundGateway。所以增加了這樣一行未指定密碼

.from(Mail.imapIdleAdapter("imaps://"+(Http.inboundGateway(String.format("%s:%[email protected]/INBOX", "myEmail", "myPassword"))).toString()) 

但問題是,在運行時就抱怨說,

javax.mail.AuthenticationFailedException: failed to connect, no password specified? 

正如你所看到的,我已經在我的要求下定義我的密碼,但它不能認識它,也我相信通過是真的

下面是完整的代碼:

@Bean     
    IntegrationFlow processInvoiceFlow() { 
     return IntegrationFlows 
      .from(Mail.imapIdleAdapter("imaps://"+(Http.inboundGateway(String.format("%s:%[email protected]/INBOX", "myEmail", "myPassword"))).toString()) 
       .selectorExpression("subject matches '.*invoice.*'")) 
      .transform("@invoiceProcessor.extractInvoice(payload)") 
      .route("#xpath(payload, '//total <= 1800', 'string')", mapping -> mapping 
       .subFlowMapping("true", sf -> sf 
        .handle("invoiceProcessor", "processInvoice")) 
       .subFlowMapping("false", sf -> sf 
        .handle(System.out::println)) 
     ) 
      .get(); 
    } 

的一點是是,我有沒有Http.inboundGateway 使用訪問該帳戶:

.from(Mail.imapIdleAdapter(String.format("imaps://%s:%[email protected]/INBOX", myEmail, myPassword)) 
+0

@Artem Bilan ... –

回答

1

你介意解釋:

我需要使用Http.inboundGateway

從另一面是什麼奇怪的代碼來調用Http.inboundGateway().toString() ...

你到底要與該代碼達到什麼?是的,它通過Java自然有效。但它是荒謬的邏輯...

你的Mail.imapIdleAdapter(String.format())看起來好多了!