Extension
When you need a custom function which is not provided by Chutney, you can implement it and load it to your chutney server.
Implement your custom function🔗
- Create a new java class.
- Declare a static method and implement it.
- Annotate it with
@SpelFunction
.
Warning
Method overloading does not work with SpEL.
Example
Load it to Chutney🔗
- create a
chutney.functions
in resources/META-INF/extension -
declare your custom class inside it:
-
Restart Chutney server and all annotated methods with
@SpelFunction
are now loaded. Check your server log, you will see something like:[main] DEBUG c.c.e.d.e.evaluation.SpelFunctions - Loading function: stringSum (MyCustomFunctions)
Use it🔗
Call your custom function from your Kotlin scenario:
Example: