Hey I followed a step by step guide for setting up kafka in spring boot.
But now I cannot start the app. Any suggestions :)
error from the log:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'functionInitializer' defined in class path resource [org/springframework/cloud/stream/function/FunctionConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Found more then one function in BeanFactory: [persistentEntities, resourceMappings]. Consider providing 'spring.cloud.function.definition' property.
What is spring.cloud.function.definition? And how to set it up? Caused by: java.lang.IllegalArgumentException: Found more then one function in BeanFactory: [persistentEntities, resourceMappings]. Consider providing 'spring.cloud.function.definition' property.
Spring Cloud Function does the following within an application:
bean
that implements OR conforms with the contract of the functional interfaces Supplier<T>
, Consumer<T>
and Function<T, R>
.beans
as potential beans
to be bound to event endpoints (bindings).bean
resolved in step 1, then that bean will be the only bean
bound as the function exposed (bound to external event endpoint) by the application - effectively assuming that the application is a Serverless Function.bean
resolved in step 1, then Spring Cloud Function will look at the property spring.cloud.function.definition
to resolved which of those beans
should be bound to endpoints.IllegalArgumentException
(the one you are getting) complaining that it cannot resolve which beans (of all the potential functional bean
that it has found) you want exposed.spring.cloud.function.definition
will be read as a semi-colon separated list of functional bean
namesSo, to solve your problem, you need to either:
Just register in the Spring context bean persistentEntities
or bean resourceMappings
; but not both.
Add the following entry to the properties of your Spring context:
spring.cloud.function.definition=persistentEntities;resourceMappings
Hope this helps.