<dependencies>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-function-adapter-aws</artifactId>
+ </dependency>
+</dependencies>
+diff --git a/spring-cloud-function/3.0.0.M1/aws.html b/spring-cloud-function/3.0.0.M1/aws.html index 3443d31a..eb18f7ca 100644 --- a/spring-cloud-function/3.0.0.M1/aws.html +++ b/spring-cloud-function/3.0.0.M1/aws.html @@ -90,6 +90,7 @@ $(addBlockSwitches);
In order to run Spring Cloud Function applications on AWS Lambda, you can leverage Maven or Gradle + plugins offered by the cloud platform provider.
+In order to use the adapter plugin for Maven, add the plugin dependency to your pom.xml
+file:
<dependencies>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-function-adapter-aws</artifactId>
+ </dependency>
+</dependencies>
+As pointed out in the Notes on JAR Layout, you wil need a shaded jar in order to upload it +to AWS Lambda. You can use the Maven Shade Plugin for that. +The example of the setup can be found above.
+You can use theSpring Boot Maven Plugin to generate the thin jar.
+<plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot.experimental</groupId>
+ <artifactId>spring-boot-thin-layout</artifactId>
+ <version>${wrapper.version}</version>
+ </dependency>
+ </dependencies>
+</plugin>
+You can find the entire sample pom.xml file for deploying Spring Cloud Function
+applications to AWS Lambda with Maven here.
In order to use the adapter plugin for Gradle, add the dependency to your build.gradle file:
dependencies {
+ compile("org.springframework.cloud:spring-cloud-function-adapter-aws:${version}")
+}
+As pointed out in Notes on JAR Layout, you wil need a shaded jar in order to upload it +to AWS Lambda. You can use the Gradle Shadow Plugin for that:
+buildscript {
+ dependencies {
+ classpath "com.github.jengelman.gradle.plugins:shadow:${shadowPluginVersion}"
+ }
+}
+apply plugin: 'com.github.johnrengelman.shadow'
+
+assemble.dependsOn = [shadowJar]
+
+import com.github.jengelman.gradle.plugins.shadow.transformers.*
+
+shadowJar {
+ classifier = 'aws'
+ dependencies {
+ exclude(
+ dependency("org.springframework.cloud:spring-cloud-function-web:${springCloudFunctionVersion}"))
+ }
+ // Required for Spring
+ mergeServiceFiles()
+ append 'META-INF/spring.handlers'
+ append 'META-INF/spring.schemas'
+ append 'META-INF/spring.tooling'
+ transform(PropertiesFileTransformer) {
+ paths = ['META-INF/spring.factories']
+ mergeStrategy = "append"
+ }
+}
+You can use the Spring Boot Gradle Plugin and Spring Boot Thin Gradle Plugin to generate +the thin jar.
+buildscript {
+ dependencies {
+ classpath("org.springframework.boot.experimental:spring-boot-thin-gradle-plugin:${wrapperVersion}")
+ classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+ }
+}
+apply plugin: 'org.springframework.boot'
+apply plugin: 'org.springframework.boot.experimental.thin-launcher'
+assemble.dependsOn = [thinJar]
+You can find the entire sample build.gradle file for deploying Spring Cloud Function
+applications to AWS Lambda with Gradle here.