You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of writing `function.json`, you can use annotations in code to specify triggers and bindings of your functions.
18
-
`function.json` can be automatically generated by [Maven Plugin for Azure Functions](https://github.com/Microsoft/azure-maven-plugins/tree/master/azure-functions-maven-plugin).
19
-
20
-
The following table lists the Java annotations for each binding type.
Your Azure function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible.
44
15
16
+
You can put multiple functions in one single project (or specifically speaking, one single jar). We strongly recommend you **not to** put your functions in separate jars (or `pom.xml`).
17
+
45
18
Typically an Azure function is invoked because of one trigger. Your function needs to process that trigger (sometimes with additional inputs) and gives one or more output values.
46
19
47
20
All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the `azure-functions-java-library` package.
@@ -63,36 +36,7 @@ public class MyClass {
63
36
64
37
### Including 3rd Party Libraries
65
38
66
-
Azure Functions only accept one single JAR file. Therefore you are required to package all your dependencies into one single JAR. A simple approach is to add the following plugin into your `pom.xml`:
67
-
68
-
```xml
69
-
<plugin>
70
-
<artifactId>maven-shade-plugin</artifactId>
71
-
<version>3.1.0</version>
72
-
<executions>
73
-
<execution>
74
-
<phase>package</phase>
75
-
<goals>
76
-
<goal>shade</goal>
77
-
</goals>
78
-
<configuration>
79
-
<filters>
80
-
<filter>
81
-
<artifact>*:*</artifact>
82
-
<excludes>
83
-
<exclude>META-INF/*.SF</exclude>
84
-
<exclude>META-INF/*.DSA</exclude>
85
-
<exclude>META-INF/*.RSA</exclude>
86
-
</excludes>
87
-
</filter>
88
-
</filters>
89
-
</configuration>
90
-
</execution>
91
-
</executions>
92
-
</plugin>
93
-
```
94
-
95
-
Sometimes you also need to care about the static constructors used in some libraries (for example, database drivers). You need to call [`Class.forName()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#forName-java.lang.String-) method to invoke the corresponding static constructor (for example `Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");`).
39
+
Azure Functions supports the use of 3rd party libraries. By default, all dependencies specified in your project pom.xml file will be automatically bundled during the `mvn package` step. For libraries that are not specified as dependencies in the pom.xml file, you may place them in a `lib` directory in the function's root directory. These will then be deployed as part of your functions application. All dependencies that are placed in the `lib` directory will be added to the system class loader at runtime.
96
40
97
41
## General Data Types
98
42
@@ -243,3 +187,9 @@ public class MyClass {
243
187
}
244
188
}
245
189
```
190
+
191
+
### License
192
+
193
+
This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE.txt)
194
+
195
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
0 commit comments