diff --git a/docs/src/main/asciidoc/adapters/aws-intro.adoc b/docs/src/main/asciidoc/adapters/aws-intro.adoc index 5897d30a0..33da52407 100644 --- a/docs/src/main/asciidoc/adapters/aws-intro.adoc +++ b/docs/src/main/asciidoc/adapters/aws-intro.adoc @@ -14,6 +14,39 @@ manifest, using the `Start-Class` attribute (which will be added for you by the tooling if you use the starter parent). If there is no `Start-Class` in your manifest you can use an environment variable or system property `MAIN_CLASS` when you deploy the function to AWS. +If you are not using the functional bean definitions but relying on Spring Boot's auto-configuration, +then additional transformers must be configured as part of the maven-shade-plugin execution. + +[source, xml] +---- + + org.apache.maven.plugins + maven-shade-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + + false + true + aws + + + META-INF/spring.handlers + + + META-INF/spring.factories + + + META-INF/spring.schemas + + + + +---- + == Upload Build the sample under `spring-cloud-function-samples/function-sample-aws` and upload the `-aws` jar file to Lambda. The handler can be `example.Handler` or `org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler` (FQN of the class, _not_ a method reference, although Lambda does accept method references). diff --git a/docs/src/main/asciidoc/adapters/aws-readme.adoc b/docs/src/main/asciidoc/adapters/aws-readme.adoc index 3fd724f7e..b2961bc43 100644 --- a/docs/src/main/asciidoc/adapters/aws-readme.adoc +++ b/docs/src/main/asciidoc/adapters/aws-readme.adoc @@ -1,3 +1,3 @@ This project provides an adapter layer for a Spring Cloud Function application onto AWS Lambda. You can write an app with a single `@Bean` of type `Function`, `Consumer` or `Supplier` and it will be deployable in AWS if you get the JAR file laid out right. The best way to make it work is to include `spring-cloud-function-context` as a dependency, but not the higher level adapters (e.g. `spring-cloud-function-stream`). -include::adapters/aws-intro.adoc[] \ No newline at end of file +include::aws-intro.adoc[] diff --git a/docs/src/main/asciidoc/adapters/aws.adoc b/docs/src/main/asciidoc/adapters/aws.adoc index 71f94ee6b..1205b43a6 100644 --- a/docs/src/main/asciidoc/adapters/aws.adoc +++ b/docs/src/main/asciidoc/adapters/aws.adoc @@ -8,12 +8,12 @@ The https://aws.amazon.com/[AWS] adapter takes a Spring Cloud Function app and c == Introduction -include::adapters/aws-intro.adoc[] +include::aws-intro.adoc[] == Functional Bean Definitions Your functions will start much quicker if you can use functional bean definitions instead of `@Bean`. To do this make your main class -an `ApplicationContextInitalizer` and use the `registerBean()` methods in `GenericApplicationContext` to +an `ApplicationContextInitializer` and use the `registerBean()` methods in `GenericApplicationContext` to create all the beans you need. You function need sto be registered as a bean of type `FunctionRegistration` so that the input and output types can be accessed by the framework. There is an example in github (the AWS sample is written in this style). It would look something like this: @@ -40,7 +40,7 @@ public class FuncApplication implements ApplicationContextInitializer