Grails 从Config.groovy在resources.XML中配置Spring集成XML
我有一个Grails应用程序,它有一些小的UI组件和域访问,但主要是运行Spring集成过程来轮询和读取电子邮件并处理结果 我希望能够根据环境配置电子邮件目标 我在Grails 从Config.groovy在resources.XML中配置Spring集成XML,grails,groovy,spring-integration,Grails,Groovy,Spring Integration,我有一个Grails应用程序,它有一些小的UI组件和域访问,但主要是运行Spring集成过程来轮询和读取电子邮件并处理结果 我希望能够根据环境配置电子邮件目标 我在resources.XML中有以下Spring集成XML片段: <mail:inbound-channel-adapter id="imapAdapter" store-uri="imaps://myEmailAddress:myPassword@imap.gmail.com/INBOX"
resources.XML
中有以下Spring集成XML片段:
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="imaps://myEmailAddress:myPassword@imap.gmail.com/INBOX"
java-mail-properties="javaMailProperties"
channel="receiveEmailChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true">
<int:poller max-messages-per-poll="1" fixed-rate="15" time-unit="SECONDS">
</int:poller>
</mail:inbound-channel-adapter>
如何将
Config.groovy
中的email.store.ui
定义绑定到resources.xml
中的storeui
属性?Grails设置了一个PropertyPlaceHolderConfigure
,它的值来自Config.groovy
,因此正常的Spring属性占位符语法应该可以工作
store-uri="${email.store.ui}"
我想我应该读到这一页的底部。。。答案在第节 我只需要:
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="${email.store.ui}"
java-mail-properties="javaMailProperties"
channel="receiveEmailChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true">
<int:poller max-messages-per-poll="1" fixed-rate="15" time-unit="SECONDS">
</int:poller>
</mail:inbound-channel-adapter>
感谢您的提示。您能将存储uri集设置为您在resources.groovy中定义的引用吗?只是一个thought@chrislovecnm我已经在
storeui
参数中添加了email.store.ui
引用,但是我找不到语法示例。谢谢你。。。我自己就想出来了,以9秒的优势击败了你谢谢你看一看。我相信你的回答。
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="${email.store.ui}"
java-mail-properties="javaMailProperties"
channel="receiveEmailChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true">
<int:poller max-messages-per-poll="1" fixed-rate="15" time-unit="SECONDS">
</int:poller>
</mail:inbound-channel-adapter>