GH-2820: Component beans and function return types
- When Kafka Streams functions are provided as component beans, the function type check in the core Spring Cloud Stream framework, fails with an NPE. Addressing this issue. Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2820
This commit is contained in:
@@ -1026,11 +1026,15 @@ public class FunctionConfiguration {
|
||||
if (this.applicationContext.containsBean(functionName)) {
|
||||
Object functionBean = this.applicationContext.getBean(functionName);
|
||||
Type functionType = FunctionTypeUtils.discoverFunctionType(functionBean, functionName, (GenericApplicationContext) this.applicationContext);
|
||||
String functionTypeStringValue = functionType.toString();
|
||||
if (functionTypeStringValue.contains("KTable") || functionTypeStringValue.contains("KStream")) {
|
||||
if (functionType == null) {
|
||||
eligibleDefinition = false;
|
||||
}
|
||||
|
||||
else {
|
||||
String functionTypeStringValue = functionType.toString();
|
||||
if (functionTypeStringValue.contains("KTable") || functionTypeStringValue.contains("KStream")) {
|
||||
eligibleDefinition = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger.warn("You have defined function definition that does not exist: " + functionName);
|
||||
|
||||
Reference in New Issue
Block a user