Tag: 弹簧集成

popup多个imapAdapter

我在spring是新手,我不喜欢代码重复。 我写了一个工作正常的ImapAdapter: @Component public class GeneralImapAdapter { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private EmailReceiverService emailReceiverService; @Bean @InboundChannelAdapter(value = "emailChannel", poller = @Poller(fixedDelay = "10000", taskExecutor = "asyncTaskExecutor")) public MessageSource<javax.mail.Message> mailMessageSource(MailReceiver imapMailReceiver) { return new MailReceivingMessageSource(imapMailReceiver); } @Bean @Value("imaps://<login>:<pass>@<url>:993/inbox") public MailReceiver imapMailReceiver(String imapUrl) { ImapMailReceiver imapMailReceiver = new ImapMailReceiver(imapUrl); imapMailReceiver.setShouldMarkMessagesAsRead(true); imapMailReceiver.setShouldDeleteMessages(false); // other setters here […]