Reputation: 158
How can i use registered beans in
For example like this:
<chain>
<si-groovy:script>
def check = myCheckBean.checkPayload(payload)
myLogBean.log(paylod)
if (check==null) throws new Exception("Verify falt")
</si-groovy:script>
<chain>
Upvotes: 0
Views: 611
Reputation: 121202
First of all your config looks bad. Should be something like this:
<chain>
<service-activator>
<si-groovy:script>
def check = myCheckBean.checkPayload(payload)
myLogBean.log(paylod)
if (check==null) throws new Exception("Verify falt")
</si-groovy:script>
<service-activator>
<chain>
Starting with Spring Integration 3.0 Groovy Scripts have access to BeanFactory
, so you can use any bean from the Context by its bean name. So, your code is compatible with Spring Integration 3.0.
If you use previous version of Spring Integration we strongly recommend to upgrade, as long as they are EOL already.
Upvotes: 1