Search code examples
spring-bootrabbitmqspring-amqpspring-rabbit

Spring AMQP: How to register a user-defined SpEL function?


Due to the Spring Expression Language Reference it's possible to register user-defined funtions which can be used in expressions.

How can I register such a function in the context of Spring AMQP in order to determine a queue name?


Solution

  • It is not fully clear in what context you'd like to determine that queue, but I believe the answer for you is still going to be that it is not possible to customize an internal EvaluationContext used in the framework for SpEL parts of configuration. As a workaround you can use a T operator for your static methods to call. Essentially those SpEL-functions are wrappers around static methods.