Skip to content

Commit

Permalink
dynamodb works
Browse files Browse the repository at this point in the history
Signed-off-by: matto <[email protected]>
  • Loading branch information
muhamadto committed Mar 25, 2024
1 parent b2e3126 commit d3eb3ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://lmk0qo0xrl.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 d3eb3ea

Please sign in to comment.