Powerful plugin system for adding custom functionality to existing applications, supporting both pre-compiled or source code, with live reload.
A simple, powerful, plugin system for adding new API endpoints or custom functionality to you Spring project. Oftentimes there are conflicting requirements from different clients utilizing a common main application. The required custom functionality needed is often easy to do with a few lines of code, but is not acceptable to add to your main code-base. With Lamebda you can load either precompiled or source files (Groovy/Java) for adding custom functionality.
It Really Whips The Lambda's Ass!
1.x releases are for Spring Boot 2.x.
2.x releases are for Spring Boot 3.x.
Add dependency to your pom.xml
<dependency>
<groupId>com.ethlo.lamebda</groupId>
<artifactId>lamebda-spring-web-starter</artifactId>
<version>2.0.1</version>
</dependency>
Add the following properties to your applications application.properties|yaml
:
lamebda.enabled=true
lamebda.root-directory=/var/lib/lamebda
lamebda.request-path=/gateway
project.properties
project.name
- Human-readable name of the project. Optional.project.base-packages
- The base packages that Spring IOC container is scanning for services and controllers.project.root-request-path-enabled
- Default is true. If you set this to false, the URLs in this project will not have the prepended gateway
path.project.url-prefix-enabled
- Default is true. If you set this to false the URLs in this project will not have the prepended project alias.Create a project folder. This folder is a logical grouping for your API functions. We will go with the creative choice test
for now. We now have the folder /var/lib/lamebda/test
.
Create a folder for the functions in the test project: /var/lib/lamebda/test/src/main/groovy/com/acme
Add a simple script in the scripts
folder:
@RestController
class MyController {
@GetMapping("/my/{id}")
def get(@PathVariable("id") int id) {
return [requested: id]
}
}
Please note that you can also write code in good ol' Java! Make sure you then put it in src/main/java/com/acme
.
Add com.acme
as base-package in your project.properties
:
project.base-packages=com.acme
Your function should be available under /gateway/test/my/123