Skip to content

An “Error creating bean with name ‘functionBindingRegistrar'” exception every time I start my application

I have a normal spring cloud stream application that simple reads data from Kafka topic and produces messages to another Kafka topic, please find below the configurations:





And the following application.proeprties

#Kafka Configurations
#Input topics



#Output topics
#productValidated 0/10 * * * *

And below is the signature of all defined spring cloud functions

public Consumer<Flux<Message<JsonNode>>> merchantCredentials() {

public Function<Message<NotificationMessage>, Message<ProductValidatedEvent>> validatedProducts() {

public Consumer<Message<ProductImportMessage>> validateImages() {

@SchedulerLock(name = "retryProcess_scheduledTask", lockAtMostFor = "${retry.job.lock.atMost}", lockAtLeastFor = "${retry.job.lock.atLeast}")
public Supplier<Flux<Message<ProductValidatedEvent>>> retryUnprocessedItems() {

Everything works fine, and the application starts and functions as it should, however, in the logs I encounter this exception multiple times, specially during the start up phase of the application

org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'functionBindingRegistrar' defined in class path resource [org/springframework/cloud/stream/function/FunctionConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Type must be one of Supplier, Function or Consumer

I have double checked all configurations and I still have no clue how can I prevent this issue from happening. Why this exception is happening? is it ignorable ?


I have tracked the bug to this function in spring framework, FunctionTypeUtils:

    public static Type discoverFunctionTypeFromClass(Class<?> functionalClass) {
    Assert.isTrue(isFunctional(functionalClass), "Type must be one of Supplier, Function or Consumer");

this function gets called by this function in FunctionConfiguration:

private String[] filterEligibleFunctionDefinitions() {
                for (int i = 0; i < functionNames.length && eligibleDefinition; i++) {
                    String functionName = functionNames[i];
                    if (this.applicationContext.containsBean(functionName)) {

And when I added debug points to this one, as well as the previous one I got the following output

functionName: merchantCredentials
functionName: validatedProducts
functionName: validateImages
functionName: retryUnprocessedItems

Showing that the retryUnprocessedItems is the culprit, not sure why though?



After some investigation, it turned out that the problem is mainly with the @SchedulerLock annotation.

I observed that this issue happens while then shedLock table has lock added on the method, and hence it was preventing the FunctionBeanRegistrar from adding the method, and so the exception.

Of course this means on the other hand that the annotation is now deemed not usable because what @PollableBean annotation really runs is not the function itself, but rather the Supplier lambda expression returned by the function, practically rendering the ShedLock useless.

Once I remove the annotation, all the exceptions are gone and the sun shines again, birds sing, etc etc..

The next question to answer would be how to use rollable bean in a distributed manner but that is out of the scope of this question