问题
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