Clean up applicability of FunctionAroundWraapper

This commit is contained in:
Oleg Zhurakousky
2022-10-31 09:18:08 +01:00
parent 62ffbc12b6
commit 931dfa22a8
2 changed files with 3 additions and 3 deletions

View File

@@ -40,8 +40,7 @@ public abstract class FunctionAroundWrapper implements BiFunction<Object, Functi
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled");
boolean functionalTracingEnabled = StringUtils.hasText(functionalTracingEnabledStr)
? Boolean.parseBoolean(functionalTracingEnabledStr) : true;
if (functionalTracingEnabled && !targetFunction.isInputTypePublisher() &&
input instanceof Message && !FunctionTypeUtils.isCollectionOfMessage(targetFunction.getOutputType())) {
if (functionalTracingEnabled && input instanceof Message) {
boolean isSkipOutputConversion = targetFunction.isSkipOutputConversion();
targetFunction.setSkipOutputConversion(true);
try {

View File

@@ -272,7 +272,8 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
*/
private FunctionInvocationWrapper wrapInAroundAdviceIfNecessary(FunctionInvocationWrapper function) {
FunctionInvocationWrapper wrappedFunction = function;
if (function != null && this.functionAroundWrapper != null) {
if (function != null && this.functionAroundWrapper != null && !function.isSupplier()
&& !function.isInputTypePublisher() && !function.isOutputTypePublisher() && !FunctionTypeUtils.isCollectionOfMessage(function.getOutputType())) {
wrappedFunction = new FunctionInvocationWrapper(function) {
@Override
Object doApply(Object input) {