我的应用程序是使用 Spring boot 开发的,这个应用程序也读取邮箱,这个邮件阅读部分是用 Spring Integration 框架实现的 .
我需要在此应用程序中使用加密所有密码 . 我正在使用Jasypt库(http://www.jasypt.org/)进行此加密 . 所有密码加密都正常, except 邮件密码 .
Problem :即邮件密码按原样发送( without decryption ) . 因此,邮件验证失败 .
代码涉及所有其他密码仅使用spring boot,因此只存在一个应用程序上下文 . 但是, mail reading part alone 是使用Spring Integration框架实现的 . 此配置使用xml文件完成,此xml文件创建第二个应用程序上下文 . 因此,对于第二个应用程序上下文,密码解密是 NOT accessible .
Jasypt库相关的加密代码存在于 1st application context 中 .
将以下基于xml的Spring Integration配置转换为基于Java的配置解决问题? (因为,只有一个应用程序上下文) . 如果是,可以为下面的任何人提供Java配置 equivalent ( prior to Java 8 version )
<beans>
<int:channel id="receiveChannel" />
<mail:inbound-channel-adapter id="pop3ShouldDeleteTrue"
store-uri="${mail.pop3.user.folder.uri}"
channel="receiveChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true"
java-mail-properties="javaMailProperties">
<int:poller max-messages-per-poll="1" fixed-rate="${actor.email.polling.interval}">
</int:poller>
</mail:inbound-channel-adapter>
<context:property-placeholder location="file:./application-${env}.properties" local-override="true" />
<util:properties id="javaMailProperties">
<prop key="${mail.socketFactory}">false</prop>
<prop key="mail.debug">false</prop>
<prop key="mail.store.protocol">${mail.store.protocol}</prop>
</util:properties>
</beans>
1 回答
为什么它在第二个应用程序环境中?
您可以在Spring Boot应用程序中使用
@ImportResource
将xml拉入主Boot上下文 .有关示例,请参阅here .
如果要转换为Java配置,this answer有一个示例 .