Home > OS >  Is there a way to get SpEL to treat a bean that is an implementation of a Functional Interface as a
Is there a way to get SpEL to treat a bean that is an implementation of a Functional Interface as a

Time:08-24

I am creating beans that are implementations of a functional interface, for example:

@FunctionalInterface
public interface FooRunnable {
    abstract Bar run();
}

I've created a bean with this interface.

I can use SpEL to call the method run() of the bean using, say, the header-enricher:

   <si:header name="bar" value="@foo.run()" />

Is there a way for SpEL to recognize that this is a functional interface and allow me to write simply the following, hence eliminate the method name?

   <si:header name="bar" value="@foo()" />

Thanks for any help/pointers.

CodePudding user response:

No; nothing like that is supported.

  • Related