Spring Function

Support for invoking methods in context of initialized Spring beans is implemented in Spring integration module.




org.smartparam.spring.SpringModule needs to be registered in configuration builder when creating ParamEngine:

ParamEngineConfig engineConfig = ParamEngineConfigBuilder.paramEngineConfig()
                .registerModule(new SpringModule(applicationContext))

To register function, annotate it with @SpringPlugin, i.e:

public void SpringPluginClass {

    private final DateProvider dateProvider;

    public SpringPluginClass(DateProvider dateProvider) {
        this.dateProvider = dateProvider;

    public Date currentDate() {
        return dateProvider.today();


Remember that com.example.plugins has to be added to scanned paths.


On function creation, name of bean is extracted using org.springframework.context.annotation.AnnotationBeanNameGenerator. Later when function is invoked bean with given name is extracted from ApplicationContext and function is invoked on this bean.