https://github.com/aws-powertools/powertools-lambda-java
Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity.
https://github.com/aws-powertools/powertools-lambda-java
aws java lambda
Last synced: about 2 months ago
JSON representation
Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity.
- Host: GitHub
- URL: https://github.com/aws-powertools/powertools-lambda-java
- Owner: aws-powertools
- License: mit-0
- Created: 2020-07-13T20:49:09.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-12T14:56:50.000Z (about 1 year ago)
- Last Synced: 2024-04-12T22:25:07.968Z (about 1 year ago)
- Topics: aws, java, lambda
- Language: Java
- Homepage: https://docs.powertools.aws.dev/lambda/java/
- Size: 20.2 MB
- Stars: 273
- Watchers: 14
- Forks: 78
- Open Issues: 60
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-java - Powertools Lambda Java
README
# Powertools for AWS Lambda (Java)
   [](https://app.codecov.io/gh/aws-powertools/powertools-lambda-java)
Powertools for AWS Lambda (Java) is a developer toolkit to implement Serverless best practices and increase developer velocity.
> Also available in [Python](https://github.com/aws-powertools/powertools-lambda-python), [TypeScript](https://github.com/aws-powertools/powertools-lambda-typescript), and [.NET](https://github.com/aws-powertools/powertools-lambda-dotnet).
**[📜Documentation](https://docs.powertools.aws.dev/lambda-java/)** | **[Feature request](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=feature-request%2C+triage&template=feature_request.md&title=)** | **[🐛Bug Report](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=bug%2C+triage&template=bug_report.md&title=)** | **[Detailed blog post](https://aws.amazon.com/blogs/opensource/simplifying-serverless-best-practices-with-aws-lambda-powertools-java/)**
## Installation
Powertools for AWS Lambda (Java) is available in Maven Central. You can use your favourite dependency management tool to install it
### Maven:
```xml...
software.amazon.lambda
powertools-tracing
1.19.0-SNAPSHOT
software.amazon.lambda
powertools-logging
1.19.0-SNAPSHOT
software.amazon.lambda
powertools-metrics
1.19.0-SNAPSHOT
...```
Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project. A different configuration is needed for projects on Java 8.
Maven - Java 11 and newer
```xml
...
dev.aspectj
aspectj-maven-plugin
1.13.1
1.8
1.8
1.8
software.amazon.lambda
powertools-logging
software.amazon.lambda
powertools-tracing
software.amazon.lambda
powertools-metrics
compile
...
```
Maven - Java 8
```xml
...
org.codehaus.mojo
aspectj-maven-plugin
1.14.0
1.8
1.8
1.8
software.amazon.lambda
powertools-logging
software.amazon.lambda
powertools-tracing
software.amazon.lambda
powertools-metrics
compile
...
```
Gradle - Java 11+
```groovy
plugins {
id 'java'
id 'io.freefair.aspectj.post-compile-weaving' version '8.2.2'
}
// the freefair aspect plugins targets gradle 8.2.1
// https://docs.freefair.io/gradle-plugins/8.2.2/reference/
wrapper {
gradleVersion = "8.2.1"
}repositories {
mavenCentral()
}
dependencies {
aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}'
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
implementation "org.aspectj:aspectjrt:1.9.8.RC3"
}
sourceCompatibility = 11
targetCompatibility = 11
```Gradle - Java 8
```groovy
plugins {
id 'java'
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
}
// the freefair aspect plugins targets gradle 7.6.1
// https://docs.freefair.io/gradle-plugins/6.6.3/reference/
wrapper {
gradleVersion = "7.6.1"
}repositories {
mavenCentral()
}
dependencies {
aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}'
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
```### Java Compatibility
Powertools for AWS Lambda (Java) supports all Java version from 8 up to 21 as well as the
[corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
For the modules that provide annotations, Powertools for AWS Lambda (Java) leverages the **aspectj** library.
You may need to add the good version of `aspectjrt` to your dependencies based on the JDK used for building your function:```xml
org.aspectj
aspectjrt
1.9.??```
JDK - aspectj dependency matrix
| JDK version | aspectj version |
|-------------|-----------------|
| `1.8` | `1.9.7` |
| `11-17` | `1.9.20.1` |
| `21` | `1.9.21` |More info [here](https://github.com/aws-powertools/powertools-lambda-java/pull/1519/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R191).
## Examples
See the latest release of the **[examples](https://github.com/aws-powertools/powertools-lambda-java/tree/v1.19.0-SNAPSHOT/examples)** for example projects showcasing usage of different utilities.
Have a demo project to contribute which showcase usage of different utilities from powertools? We are happy to accept it [here](CONTRIBUTING.md#security-issue-notifications).
## How to support Powertools for AWS Lambda (Java)?
### Becoming a reference customer
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Java), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (Java) (become a reference)](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E) issue.
The following companies, among others, use Powertools:
* [Capital One](https://www.capitalone.com/)
* [Caylent](https://caylent.com/)
* [CPQi (Exadel Financial Services)](https://cpqi.com/)
* [Europace AG](https://europace.de/)
* [Vertex Pharmaceuticals](https://www.vrtx.com/)## Credits
* [MkDocs](https://www.mkdocs.org/)
* [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)## Connect
* **Powertools for AWS Lambda on Discord**: `#java` - **[Invite link](https://discord.gg/B8zZKbbyET)**
* **Email**:## Security disclosures
If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please follow the instructions [here](https://aws.amazon.com/security/vulnerability-reporting/) or [email AWS security directly](mailto:[email protected]).
## License
This library is licensed under the Apache License, Version 2.0. See the LICENSE file.