Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ jobs:
strategy:
matrix:
java:
- 11
- 17
- 21
- 25
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/check-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ jobs:
max-parallel: 20
matrix:
java:
- 11
- 17
- 21
- 25
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<source>11</source>
<target>11</target>
<complianceLevel>11</complianceLevel>
<source>17</source>
<target>17</target>
<complianceLevel>17</complianceLevel>
<aspectLibraries>
<aspectLibrary>
<groupId>software.amazon.lambda</groupId>
Expand Down Expand Up @@ -120,14 +120,14 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
implementation "org.aspectj:aspectjrt:1.9.22"
}

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17
```
</details>


### Java Compatibility
Powertools for AWS Lambda (Java) supports all Java versions from 11 to 25 in line with the [corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
Powertools for AWS Lambda (Java) supports all Java versions from 17 to 25 in line with 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 appropriate version of `aspectjrt` to your dependencies based on the JDK used for building your function:
Expand All @@ -146,10 +146,10 @@ You may need to add the appropriate version of `aspectjrt` to your dependencies
Use the following [dependency matrix](https://github.com/eclipse-aspectj/aspectj/blob/master/docs/release/JavaVersionCompatibility.adoc) to understand which AspectJ version to use based on your JDK version:

| JDK version | aspectj version |
|-------------|------------------------|
| `11-17` | `1.9.20.1` (or higher) |
| `21` | `1.9.21` (or higher) |
| `25` | `1.9.25` (or higher) |
|-----------|------------------------|
| `17` | `1.9.20.1` (or higher) |
| `21` | `1.9.21` (or higher) |
| `25` | `1.9.25` (or higher) |

</details>

Expand Down
20 changes: 10 additions & 10 deletions docs/core/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Depending on preference, you must choose to use either _log4j2_ or _logback_ as
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<source>11</source> <!-- or higher -->
<target>11</target> <!-- or higher -->
<complianceLevel>11</complianceLevel> <!-- or higher -->
<source>17</source> <!-- or higher -->
<target>17</target> <!-- or higher -->
<complianceLevel>17</complianceLevel> <!-- or higher -->
<aspectLibraries>
<aspectLibrary>
<groupId>software.amazon.lambda</groupId>
Expand Down Expand Up @@ -113,9 +113,9 @@ Depending on preference, you must choose to use either _log4j2_ or _logback_ as
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<source>11</source> <!-- or higher -->
<target>11</target> <!-- or higher -->
<complianceLevel>11</complianceLevel> <!-- or higher -->
<source>17</source> <!-- or higher -->
<target>17</target> <!-- or higher -->
<complianceLevel>17</complianceLevel> <!-- or higher -->
<aspectLibraries>
<aspectLibrary>
<groupId>software.amazon.lambda</groupId>
Expand Down Expand Up @@ -163,8 +163,8 @@ Depending on preference, you must choose to use either _log4j2_ or _logback_ as
implementation 'software.amazon.lambda:powertools-logging-log4j:{{ powertools.version }}'
}

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17
```

=== "logback"
Expand All @@ -184,8 +184,8 @@ Depending on preference, you must choose to use either _log4j2_ or _logback_ as
implementation 'software.amazon.lambda:powertools-logging-logback:{{ powertools.version }}'
}

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17
```


Expand Down
12 changes: 6 additions & 6 deletions docs/core/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ Visit the AWS documentation for a complete explanation for [Amazon CloudWatch co
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<source>11</source> <!-- or higher -->
<target>11</target> <!-- or higher -->
<complianceLevel>11</complianceLevel> <!-- or higher -->
<source>17</source> <!-- or higher -->
<target>17</target> <!-- or higher -->
<complianceLevel>17</complianceLevel> <!-- or higher -->
<aspectLibraries>
<aspectLibrary>
<groupId>software.amazon.lambda</groupId>
Expand Down Expand Up @@ -105,8 +105,8 @@ Visit the AWS documentation for a complete explanation for [Amazon CloudWatch co
implementation 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}' // Use this instead of 'aspect' when using the functional approach
}

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17
```

## Getting started
Expand Down Expand Up @@ -181,7 +181,7 @@ For most use-cases, we recommend using Environment variables and only overwrite
Type: AWS::Serverless::Function
Properties:
...
Runtime: java11
Runtime: java17
Environment:
Variables:
POWERTOOLS_SERVICE_NAME: payment
Expand Down
14 changes: 7 additions & 7 deletions docs/core/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ a provides functionality to reduce the overhead of performing common tracing tas
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<source>11</source> <!-- or higher -->
<target>11</target> <!-- or higher -->
<complianceLevel>11</complianceLevel> <!-- or higher -->
<source>17</source> <!-- or higher -->
<target>17</target> <!-- or higher -->
<complianceLevel>17</complianceLevel> <!-- or higher -->
<aspectLibraries>
<aspectLibrary>
<groupId>software.amazon.lambda</groupId>
Expand Down Expand Up @@ -89,8 +89,8 @@ a provides functionality to reduce the overhead of performing common tracing tas
implementation 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}' // Use this instead of 'aspect' when using the functional approach
}

sourceCompatibility = 11 // or higher
targetCompatibility = 11 // or higher
sourceCompatibility = 17 // or higher
targetCompatibility = 17 // or higher
```

## Initialization
Expand All @@ -107,7 +107,7 @@ Before your use this utility, your AWS Lambda function [must have permissions](h
Type: AWS::Serverless::Function
Properties:
...
Runtime: java11
Runtime: java17

Tracing: Active
Environment:
Expand Down Expand Up @@ -217,7 +217,7 @@ specifying a different `captureMode` to always record response, exception, both,
Type: AWS::Serverless::Function
Properties:
...
Runtime: java11
Runtime: java17

Tracing: Active
Environment:
Expand Down
20 changes: 10 additions & 10 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ Powertools for AWS Lambda (Java) dependencies are available in Maven Central. Yo
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<source>11</source> <!-- or higher -->
<target>11</target> <!-- or higher -->
<complianceLevel>11</complianceLevel> <!-- or higher -->
<source>17</source> <!-- or higher -->
<target>17</target> <!-- or higher -->
<complianceLevel>17</complianceLevel> <!-- or higher -->
<aspectLibraries>
<aspectLibrary>
<groupId>software.amazon.lambda</groupId>
Expand Down Expand Up @@ -183,15 +183,15 @@ Powertools for AWS Lambda (Java) dependencies are available in Maven Central. Yo
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
}

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17
```

???+ tip "Don't want to use AspectJ?"
Powertools for AWS Lambda (Java) now provides a functional API that doesn't require AspectJ configuration. Learn more about the [functional approach](./usage-patterns.md#functional-approach).

### Java Compatibility
Powertools for AWS Lambda (Java) supports all Java versions from 11 to 25 in line with the [corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
Powertools for AWS Lambda (Java) supports all Java versions from 17 to 25 in line with the [corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).

In addition to the functional approach, [Logging](./core/logging.md), [Metrics](./core/metrics.md), [Tracing](./core/tracing.md), [Parameters](./utilities/parameters.md), [Idempotency](./utilities/idempotency.md), [Validation](./utilities/validation.md), and [Large Messages](./utilities/large_messages.md) utilities support annotations using AspectJ, which require configuration of the `aspectjrt` runtime library.

Expand All @@ -208,10 +208,10 @@ You may need to add the appropriate version of `aspectjrt` to your dependencies
Use the following [dependency matrix](https://github.com/eclipse-aspectj/aspectj/blob/master/docs/release/JavaVersionCompatibility.adoc) to understand which AspectJ version to use based on your JDK version:

| JDK version | aspectj version |
|-------------|------------------------|
| `11-17` | `1.9.20.1` (or higher) |
| `21` | `1.9.21` (or higher) |
| `25` | `1.9.25` (or higher) |
|----------|------------------------|
| `17` | `1.9.20.1` (or higher) |
| `21` | `1.9.21` (or higher) |
| `25` | `1.9.25` (or higher) |

## Environment variables

Expand Down
34 changes: 17 additions & 17 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ We've made minimal breaking changes to make your transition to `v2` as smooth as

The following table shows a summary of the changes made in `v2` and whether code changes are necessary. Each change that requires a code change links to a section below explaining more details.

| Area | Change | Code change required |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| **Logging** | The [logging module was re-designed](#redesigned-logging-utility) from scratch to support popular Java logging paradigms and libraries like `log4j2`, `logback`, and `slf4j`. | Yes |
| **Metrics** | [Changed public interface](#updated-metrics-utility-interface) to remove direct coupling with `aws-embedded-metrics-java`. | Yes |
| **Tracing** | [Removed deprecated `captureResponse` and `captureError` options](#deprecated-capture-mode-related-tracing-annotation-parameters) on `@Tracing` annotation. | Yes |
| **Idempotency** | The [`powertools-idempotency` module was split by provider](#idempotency-utility-split-into-sub-modules-by-provider) to improve modularity and reduce the deployment package size. | Yes |
| **Idempotency** | Updated `IdempotencyConfig` interface to support addition of response hooks. | No |
| **Parameters** | The [`powertools-parameters` module was split by provider](#parameters-utility-split-into-sub-modules-by-provider) to improve modularity and reduce the deployment package size. | Yes |
| Area | Change | Code change required |
| -------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------------------- |
| **Logging** | The [logging module was re-designed](#redesigned-logging-utility) from scratch to support popular Java logging paradigms and libraries like `log4j2`, `logback`, and `slf4j`. | Yes |
| **Metrics** | [Changed public interface](#updated-metrics-utility-interface) to remove direct coupling with `aws-embedded-metrics-java`. | Yes |
| **Tracing** | [Removed deprecated `captureResponse` and `captureError` options](#deprecated-capture-mode-related-tracing-annotation-parameters) on `@Tracing` annotation. | Yes |
| **Idempotency** | The [`powertools-idempotency` module was split by provider](#idempotency-utility-split-into-sub-modules-by-provider) to improve modularity and reduce the deployment package size. | Yes |
| **Idempotency** | Updated `IdempotencyConfig` interface to support addition of response hooks. | No |
| **Parameters** | The [`powertools-parameters` module was split by provider](#parameters-utility-split-into-sub-modules-by-provider) to improve modularity and reduce the deployment package size. | Yes |
| **Batch Processing** | [Removed deprecated `powertools-sqs` module](#removed-powertools-sqs-module-in-favor-of-powertools-batch) in favor of the more generic [Batch Processing](./utilities/batch.md) utility. | Yes |
| **Batch Processing** | Updated Batch Processing `BatchMessageHandler` interface to add support for parallel processing. | No |
| **Validation** | The `@Validation` utility returns 4xx error codes instead of 5xx error codes when used with API Gateway now. | No |
| **Validation** | Validating batch event sources now adds failed events as partial batch failures and does not fail the whole batch anymore. | No |
| **Custom Resources** | [Removed deprecated `Response.failed()` and `Response.success()` methods](#custom-resources-updates-the-response-class). | Yes |
| **Custom Resources** | Changed interface of `Response` class to add an optional `reason` field. | No |
| **Dependencies** | Renamed `powertools-core` to `powertools-common`. This module should not be used as direct dependency and is listed here for completeness. | No |
| **Dependencies** | [Removed `org.aspectj.aspectjrt` as project dependency](#aspectj-runtime-not-included-by-default-anymore) in favor of consumers including the version they prefer. | Yes |
| **Language support** | Removed support for Java 8. The minimum required Java version is Java 11. | N/A |
| **Batch Processing** | Updated Batch Processing `BatchMessageHandler` interface to add support for parallel processing. | No |
| **Validation** | The `@Validation` utility returns 4xx error codes instead of 5xx error codes when used with API Gateway now. | No |
| **Validation** | Validating batch event sources now adds failed events as partial batch failures and does not fail the whole batch anymore. | No |
| **Custom Resources** | [Removed deprecated `Response.failed()` and `Response.success()` methods](#custom-resources-updates-the-response-class). | Yes |
| **Custom Resources** | Changed interface of `Response` class to add an optional `reason` field. | No |
| **Dependencies** | Renamed `powertools-core` to `powertools-common`. This module should not be used as direct dependency and is listed here for completeness. | No |
| **Dependencies** | [Removed `org.aspectj.aspectjrt` as project dependency](#aspectj-runtime-not-included-by-default-anymore) in favor of consumers including the version they prefer. | Yes |
| **Language support** | Removed support for Java 11. The minimum required Java version is Java 17. | N/A |

### First Steps

Before you start, we suggest making a copy of your current working project or create a new branch with `git`.

1. **Upgrade** Java to at least version 11. While version 11 is supported, we recommend using the [newest available LTS version](https://downloads.corretto.aws/#/downloads){target="\_blank"} of Java.
1. **Upgrade** Java to at least version 17. While version 17 is supported, we recommend using the [newest available LTS version](https://downloads.corretto.aws/#/downloads){target="\_blank"} of Java.
2. **Review** the following section to confirm if you need to make changes to your code.

## Redesigned Logging Utility
Expand Down
Loading