Posts

Showing posts from May, 2019

Dual Spring Boot and AWS Lambda Project

Image
Sometimes, we need to convert an existing Spring Boot application to AWS Lambda function, often due to upgrade in technology or company's new direction to the sky.. I mean cloud and beyond... In some extremely rare case we might be forced to write a dual Spring Boot and AWS Lambda project, that is a project that can run as a Spring Boot application in its embedded Tomcat container and also can be uploaded as AWS Lambda function. This usually happens when one of the developer in the team has had one too many "discussions" about Spring Boot or Lambda that he proceeded to create dual app while the rest of the team going round and round in circle. Luckily, awslabs has answer to that, they call it Serverless Java Container :  https://github.com/awslabs/aws-serverless-java-container Here is my simple example on how to achieve the dual Spring Boot x AWS Lambda application: The source:  https://github.com/overtakerx/springbootawslambdademo  contains a simple typical S

Spring Boot 2: Spring WebFlux for Reactive APIs

Spring Boot 2: Spring WebFlux for Reactive APIs Spring WebFlux is a relatively new library from Spring Boot 2 that provides massive improvement in performance compared to the traditional sync calls. To quote the Spring documentation itself: Why was Spring WebFlux created? Part of the answer is the need for a non-blocking web stack to handle concurrency with a small number of threads and scale with fewer hardware resources. Servlet 3.1 did provide an API for non-blocking I/O. However, using it leads away from the rest of the Servlet API, where contracts are synchronous ( Filter ,  Servlet ) or blocking ( getParameter ,  getPart ). This was the motivation for a new common API to serve as a foundation across any non-blocking runtime. That is important because of servers (such as Netty) that are well-established in the async, non-blocking space. Further reading:  https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html In short, Spring Webflux