GH-265 Added support for injecting execution context

- Added support for injecting target execution context into the ApplicationContext in AbstractSpringFunctionAdapterInitializer, effectively making it available to all adapters (if one is provided)
- Added test, docs

Resolves #265
This commit is contained in:
Oleg Zhurakousky
2019-03-01 17:07:03 +01:00
parent 3f4401f9be
commit d20171d196
3 changed files with 47 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.microsoft.azure.functions.ExecutionContext;
import org.junit.After;
import org.junit.Test;
import reactor.core.publisher.Flux;
@@ -151,8 +152,11 @@ public class AzureSpringBootRequestHandlerTests {
protected static class AutoConfig {
@Bean
public Function<Foo, Bar> uppercase() {
return foo -> new Bar(foo.getValue().toUpperCase());
public Function<Foo, Bar> uppercase(ExecutionContext targetContext) {
return foo -> {
targetContext.getLogger().info("Invoking 'uppercase' on " + foo.getValue());
return new Bar(foo.getValue().toUpperCase());
};
}
}