Unleash / unleash-spring-boot-starter

Apache License 2.0
1 stars 8 forks source link

Only the last context preprocessor is applied #27

Open GFriedrich opened 1 year ago

GFriedrich commented 1 year ago

Describe the bug

When registering multiple context preprocessors, only the last processor is applied.

Steps to reproduce the bug

  1. Register multiple context pre processors
  2. Create an interface using the @Toggle annotation
  3. See that only the last pre processor is used

Expected behavior

All pre processors should be taken into account.

Logs, error output, etc.

No response

Screenshots

No response

Additional context

The problem here is within the FeatureAdvisor class: https://github.com/Unleash/unleash-spring-boot-starter/blob/2ceccc9b757fd0735a3d87b3354f55bd1e3143c7/springboot-unleash-core/src/main/java/org/unleash/features/aop/FeatureAdvisor.java#L147

As you can see the preProcess method is called each time with the original supplier argument instead of using the previously wrapped returnValue.

A correct line should be returnValue = contextPreProcessor.preProcess(returnValue);

Unleash version

1.0.1

Subscription type

None

Hosting type

None

SDK information (language and version)

No response