Regex with SpEl usage

给你一囗甜甜゛ 提交于 2019-12-12 02:43:58

问题


How to use regex with SpEL?

Would like to append system properties along with SpEL and regex .

expected output : devInmessagebase/devInmessagetest/devInmessagesample

dev :'env' variable

Inmessage : from properties file(in.topic.mesge)

asterisk(*) : base/test/sample(anything as suffix)

Tried as below and many other ways but not working.any suggestion?

 <int-kafka:consumer-configuration group-id="default3" value-decoder="kafkaSpecificDecoder" 
            key-decoder="kafkaReflectionDecoder" max-messages="10"> 
            <int-kafka:topic-filter pattern="${systemProperties['env'] + in.topic.mesge.'*'}" streams="4" exclude="false" /> </int-kafka:consumer-configuration>

回答1:


The correct syntax for the pattern attribute is:

pattern="#{systemProperties['env'] + '${in.topic.mesge}' + '.*'}"


来源:https://stackoverflow.com/questions/33132019/regex-with-spel-usage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!