Describe the bug
I have a consumer bean:
BindingConsumer<Message<String>> consumer(){...}
This is my class that implements Consumer interface:
class BindingConsumer<T> implements Consumer<T>
When I run test it fails with error:
Caused by: java.lang.IllegalArgumentException: Class must not be null
at org.springframework.util.Assert.notNull(Assert.java:182) ~[spring-core-7.0.3.jar:7.0.3]
at org.springframework.core.ResolvableType.forClassWithGenerics(ResolvableType.java:1172) ~[spring-core-7.0.3.jar:7.0.3]
at org.springframework.cloud.function.context.catalog.FunctionTypeUtils.resolveType(FunctionTypeUtils.java:386) ~[spring-cloud-function-context-5.0.1.jar:5.0.1]
at org.springframework.cloud.function.context.catalog.FunctionTypeUtils.getInputType(FunctionTypeUtils.java:436) ~[spring-cloud-function-context-5.0.1.jar:5.0.1]
at org.springframework.cloud.function.context.FunctionRegistration.type(FunctionRegistration.java:129) ~[spring-cloud-function-context-5.0.1.jar:5.0.1]
at org.springframework.cloud.function.context.catalog.BeanFactoryAwareFunctionRegistry.lookup(BeanFactoryAwareFunctionRegistry.java:192) ~[spring-cloud-function-context-5.0.1.jar:5.0.1]
If I change my class signature:
class BindingConsumer<T> implements Consumer<Message<T>>
and create bean:
BindingConsumer<String> consumer(){...}
Everything works fine.
Looks like a bug in
org.springframework.cloud.function.context.catalog.FunctionTypeUtils#resolveType
return ResolvableType.forClassWithGenerics(typeWithGenerics.getRawClass(),
resolvedGenerics.toArray(new ResolvableType[0])).getType();
typeWithGenerics.getRawClass() returns null. I think it can be more smart and return Message
Describe the bug
I have a consumer bean:
This is my class that implements Consumer interface:
When I run test it fails with error:
If I change my class signature:
and create bean:
Everything works fine.
Looks like a bug in
org.springframework.cloud.function.context.catalog.FunctionTypeUtils#resolveType
typeWithGenerics.getRawClass()returns null. I think it can be more smart and returnMessage