├── .gitignore ├── src └── main │ ├── resources │ └── application.properties │ └── java │ └── com │ └── morethanheroic │ └── uppercase │ ├── domain │ ├── UppercaseRequest.java │ └── UppercaseResponse.java │ ├── service │ └── UppercaseService.java │ ├── UpperFunctionApplication.java │ ├── handler │ └── aws │ │ └── UppercaseFunctionHandler.java │ └── UppercaseFunction.java ├── README.md └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | *.iml 3 | /.idea/ -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.jmx.enabled=true -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | An example repository for an article about running Spring Cloud Functions on AWS Lambda. 2 | 3 | The article is available here: https://dzone.com/articles/run-code-with-spring-cloud-function-on-aws-lambda 4 | -------------------------------------------------------------------------------- /src/main/java/com/morethanheroic/uppercase/domain/UppercaseRequest.java: -------------------------------------------------------------------------------- 1 | package com.morethanheroic.uppercase.domain; 2 | 3 | public class UppercaseRequest { 4 | 5 | private String input; 6 | 7 | public String getInput() { 8 | return input; 9 | } 10 | 11 | public void setInput(final String input) { 12 | this.input = input; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/morethanheroic/uppercase/domain/UppercaseResponse.java: -------------------------------------------------------------------------------- 1 | package com.morethanheroic.uppercase.domain; 2 | 3 | public class UppercaseResponse { 4 | 5 | private String result; 6 | 7 | public String getResult() { 8 | return result; 9 | } 10 | 11 | public void setResult(final String result) { 12 | this.result = result; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/morethanheroic/uppercase/service/UppercaseService.java: -------------------------------------------------------------------------------- 1 | package com.morethanheroic.uppercase.service; 2 | 3 | import java.util.Locale; 4 | 5 | import org.springframework.stereotype.Service; 6 | 7 | @Service 8 | public class UppercaseService { 9 | 10 | public String uppercase(final String input) { 11 | return input.toUpperCase(Locale.ENGLISH); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/morethanheroic/uppercase/UpperFunctionApplication.java: -------------------------------------------------------------------------------- 1 | package com.morethanheroic.uppercase; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class UpperFunctionApplication { 8 | 9 | public static void main(String[] args) throws Exception { 10 | SpringApplication.run(UpperFunctionApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/morethanheroic/uppercase/handler/aws/UppercaseFunctionHandler.java: -------------------------------------------------------------------------------- 1 | package com.morethanheroic.uppercase.handler.aws; 2 | 3 | import org.springframework.cloud.function.adapter.aws.SpringBootRequestHandler; 4 | 5 | import com.morethanheroic.uppercase.domain.UppercaseRequest; 6 | import com.morethanheroic.uppercase.domain.UppercaseResponse; 7 | 8 | public class UppercaseFunctionHandler extends SpringBootRequestHandler { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/morethanheroic/uppercase/UppercaseFunction.java: -------------------------------------------------------------------------------- 1 | package com.morethanheroic.uppercase; 2 | 3 | import java.util.function.Function; 4 | 5 | import org.springframework.stereotype.Component; 6 | 7 | import com.morethanheroic.uppercase.domain.UppercaseRequest; 8 | import com.morethanheroic.uppercase.domain.UppercaseResponse; 9 | import com.morethanheroic.uppercase.service.UppercaseService; 10 | 11 | @Component 12 | public class UppercaseFunction implements Function { 13 | 14 | private final UppercaseService uppercaseService; 15 | 16 | public UppercaseFunction(final UppercaseService uppercaseService) { 17 | this.uppercaseService = uppercaseService; 18 | } 19 | 20 | @Override 21 | public UppercaseResponse apply(final UppercaseRequest uppercaseRequest) { 22 | final UppercaseResponse result = new UppercaseResponse(); 23 | 24 | result.setResult(uppercaseService.uppercase(uppercaseRequest.getInput())); 25 | 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.morethanheroic 8 | spring-cloud-function-aws-example 9 | 1.0-SNAPSHOT 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 2.1.3.RELEASE 15 | 16 | 17 | 18 | 19 | com.morethanheroic.uppercase.UpperFunctionApplication 20 | 21 | 22 | 23 | 24 | org.springframework.cloud 25 | spring-cloud-function-adapter-aws 26 | 2.0.1.RELEASE 27 | 28 | 29 | com.amazonaws 30 | aws-lambda-java-events 31 | 2.2.6 32 | provided 33 | 34 | 35 | com.amazonaws 36 | aws-lambda-java-log4j 37 | 1.0.0 38 | provided 39 | 40 | 41 | 42 | 43 | 44 | 45 | org.apache.maven.plugins 46 | maven-compiler-plugin 47 | 48 | 1.8 49 | 1.8 50 | 51 | 52 | 53 | org.springframework.boot 54 | spring-boot-maven-plugin 55 | 56 | 57 | org.springframework.boot.experimental 58 | spring-boot-thin-layout 59 | 1.0.11.RELEASE 60 | 61 | 62 | 63 | 64 | org.apache.maven.plugins 65 | maven-shade-plugin 66 | 67 | false 68 | true 69 | aws 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | spring-snapshots 78 | Spring Snapshots 79 | https://repo.spring.io/snapshot 80 | 81 | true 82 | 83 | 84 | 85 | spring-milestones 86 | Spring Milestones 87 | https://repo.spring.io/milestone 88 | 89 | false 90 | 91 | 92 | 93 | 94 | 95 | spring-snapshots 96 | Spring Snapshots 97 | https://repo.spring.io/snapshot 98 | 99 | true 100 | 101 | 102 | 103 | spring-milestones 104 | Spring Milestones 105 | https://repo.spring.io/milestone 106 | 107 | false 108 | 109 | 110 | 111 | --------------------------------------------------------------------------------