我需要定期检查大约30个邮箱,并希望仅使用注释进行此操作。我知道如何使用XML文件来完成,它看起来像这样:
<mail:inbound-channel-adapter id="ImapAdapter"
store-uri="imaps://${login}:${pass}@${host}:993/inbox"
channel="testReceiveEmailChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true"
java-mail-properties="javaMailProperties">
<int:poller fixed-delay="200"
time-unit="SECONDS"
task-executor="asyncTaskExecutor"/>
</mail:inbound-channel-adapter>
<int:channel id="testReceiveEmailChannel">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:service-activator input-channel="testReceiveEmailChannel"
ref="testMailReceiverService"
method="receive"/>
<bean id="testMailReceiverService" class="com.myproject.email.EmailReceiverService">
<property name="mailBox" value="${login}"/>
</bean>
<int:logging-channel-adapter id="logger" level="DEBUG"/>
我知道Spring 4+有@InboundChannelAdapter
,但我不知道如何使用它。实际上,我是Spring的新手,因此非常感谢任何帮助!