Handler for azure sample calls super in different method
If FooHandler extends AzureSpringBootRequestHandler apparently Azure cannot extract the generic types Foo and Bar.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
|
||||
<id>azure</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<baseDirectory></baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/azure-functions/${functionAppName}</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>*-azure.jar</include>
|
||||
<include>**/*.json</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -1,2 +1,3 @@
|
||||
{
|
||||
"functionTimeout": "00:10:00"
|
||||
}
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
{
|
||||
"scriptFile" : "../function-sample-azure-1.0.0.BUILD-SNAPSHOT-azure.jar",
|
||||
"entryPoint" : "example.FooHandler.handleRequest",
|
||||
"bindings" : [ {
|
||||
"type" : "httpTrigger",
|
||||
"name" : "foo",
|
||||
"direction" : "in",
|
||||
"authLevel" : "anonymous",
|
||||
"methods" : [ "get", "post" ]
|
||||
}, {
|
||||
"type" : "http",
|
||||
"name" : "$return",
|
||||
"direction" : "out"
|
||||
} ],
|
||||
"disabled" : false
|
||||
"scriptFile": "../function-sample-azure-1.0.0.BUILD-SNAPSHOT-azure.jar",
|
||||
"entryPoint": "example.FooHandler.execute",
|
||||
"bindings": [
|
||||
{
|
||||
"type": "httpTrigger",
|
||||
"name": "foo",
|
||||
"direction": "in",
|
||||
"authLevel": "anonymous",
|
||||
"methods": [
|
||||
"get",
|
||||
"post"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "http",
|
||||
"name": "$return",
|
||||
"direction": "out"
|
||||
}
|
||||
],
|
||||
"disabled": false
|
||||
}
|
||||
@@ -23,15 +23,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@SpringBootApplication
|
||||
class FooConfig {
|
||||
public class Config {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(Config.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Foo, Bar> uppercase() {
|
||||
return value -> new Bar(value.getValue().toUpperCase());
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(FooConfig.class, args);
|
||||
return foo -> new Bar(foo.getValue().toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
package example;
|
||||
|
||||
import com.microsoft.azure.serverless.functions.ExecutionContext;
|
||||
import com.microsoft.azure.serverless.functions.annotation.HttpOutput;
|
||||
import com.microsoft.azure.serverless.functions.annotation.HttpTrigger;
|
||||
|
||||
import org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler;
|
||||
|
||||
@@ -27,12 +25,8 @@ import org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHa
|
||||
*/
|
||||
public class FooHandler extends AzureSpringBootRequestHandler<Foo, Bar> {
|
||||
|
||||
@Override
|
||||
public @HttpOutput(name = "bar") Bar handleRequest(
|
||||
@HttpTrigger(name = "foo", methods = { "get", "post" }) Foo foo,
|
||||
ExecutionContext context) {
|
||||
context.getLogger().info("Invoking entry point method");
|
||||
return (Bar) super.handleRequest(foo, context);
|
||||
public Bar execute(Foo foo, ExecutionContext context) {
|
||||
return handleRequest(foo, context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user