It depends on how you do configuration, but yes. Certainly, there's no way to do it with XML config. But if you are using JavaConfig and the bean you're creating requires a functional type, then there's no reason you couldn't just pass a lambda or method reference into the setter or constructor arg.
On the other hand, if you're asking if it's possible to declare a lambda as a bean, then I'm not so sure. I'd wonder what that would even look like. i suppose that it'd be possible to manually register a lambda as a bean by calling registerBean() on a given GenericApplicationContext, but I can't say that I've tried it. (I have used Lambdas to define a bean of a given type when calling registerBean(), but never have had the bean itself be defined as a Lambda.)
Will Myers wrote:Hi,
Does Spring 5 allow you to inject a lambda into a bean via configuration?