Skip to content

Commit

Permalink
dynamodb works
Browse files Browse the repository at this point in the history
  • Loading branch information
muhamadto committed Mar 27, 2024
1 parent b2e3126 commit 4c06741
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ Now that the setup is done you can deploy to AWS.
POST

```shell
$ curl --location --request POST 'https://lmk0qo0xrl.execute-api.ap-southeast-2.amazonaws.com/dev/' \
$ curl --location --request POST 'https://{apiid}.execute-api.ap-southeast-2.amazonaws.com/dev/' \
--header 'Content-Type: application/json' \
--data-raw '{
"env": "production",
Expand All @@ -467,14 +467,7 @@ POST
GET

```shell
curl --location --request POST 'http://localhost:8080' \
--header 'Content-Type: application/json' \
--data-raw '{
"httpMethod": "GET",
"pathParameters": {
"proxy": "production-1234-someapp"
}
}'
curl --request GET 'https://{apiid}.execute-api.ap-southeast-2.amazonaws.com/dev/production-1234-someapp'
```
3. Et voila! It runs with 500 ms for cold start.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package com.coffeebeans.springnativeawslambda;

import java.util.List;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
import com.coffeebeans.springnativeawslambda.model.Secret;
Expand All @@ -29,18 +28,21 @@
import org.springframework.aot.hint.TypeReference;
import org.springframework.lang.Nullable;

import java.util.List;

public class ReflectionRuntimeHints implements RuntimeHintsRegistrar {

@Override
public void registerHints(final RuntimeHints hints, @Nullable final ClassLoader classLoader) {
final List<TypeReference> typeReferences = List.of(
TypeReference.of(DateTime.class),
TypeReference.of(Secret.class),
TypeReference.of(APIGatewayProxyResponseEvent.class),
TypeReference.of(APIGatewayProxyRequestEvent.class),
TypeReference.of(APIGatewayProxyRequestEvent.ProxyRequestContext.class)
);
@Override
public void registerHints(final RuntimeHints hints, @Nullable final ClassLoader classLoader) {
final List<TypeReference> typeReferences = List.of(
TypeReference.of(DateTime.class),
TypeReference.of(Secret.class),
TypeReference.of(APIGatewayProxyResponseEvent.class),
TypeReference.of(APIGatewayProxyRequestEvent.class),
TypeReference.of(APIGatewayProxyRequestEvent.ProxyRequestContext.class),
TypeReference.of(APIGatewayProxyRequestEvent.RequestIdentity.class)
);

hints.reflection().registerTypes(typeReferences, builder -> builder.withMembers(MemberCategory.values()));
}
hints.reflection().registerTypes(typeReferences, builder -> builder.withMembers(MemberCategory.values()));
}
}

0 comments on commit 4c06741

Please sign in to comment.