Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .github/workflows/native-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ jobs:
label=$(docker image inspect -f '{{index .Config.Labels "service"}}' "$IMAGE:${{ github.sha }}")
echo "service label: '$label'"
test "$label" = fullstack-with-spring
- name: Smoke test native image
run: |
docker run -d --name smoke -p 8080:8080 "$IMAGE:${{ github.sha }}"
for i in $(seq 30); do curl -fs localhost:8080/ >/dev/null && break; sleep 1; done
for path in / /tables /forms "/lineChartComponent?name=Sales"; do
curl -fsS -o /dev/null -w "%{http_code} $path\n" "localhost:8080$path" || { docker logs smoke | tail -40; exit 1; }
done
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: docker save "$IMAGE:${{ github.sha }}" | gzip > image.tar.gz
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
networkTimeout=120000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package de.tschuehly.fullstackdemo.common
import de.tschuehly.fullstackdemo.web.component.person.form.PersonFormViewComponent
import de.tschuehly.spring.viewcomponent.thymeleaf.ViewContext
import org.springframework.aot.hint.BindingReflectionHintsRegistrar
import org.springframework.aot.hint.MemberCategory
import org.springframework.aot.hint.TypeReference
import org.springframework.aot.hint.RuntimeHints
import org.springframework.aot.hint.RuntimeHintsRegistrar
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
Expand All @@ -27,6 +29,8 @@ class NativeHints : RuntimeHintsRegistrar {
}
val contexts = scanner.findCandidateComponents("de.tschuehly.fullstackdemo")
.map { Class.forName(it.beanClassName, false, classLoader) }
// Kotlin reflection resolves emptyList()'s class when a chart has no data (/lineChartComponent?name=Sales).
hints.reflection().registerType(TypeReference.of("kotlin.collections.EmptyList"), *MemberCategory.entries.toTypedArray())
BindingReflectionHintsRegistrar().registerReflectionHints(
hints.reflection(), *(contexts + PersonFormViewComponent.PersonFormDTO::class.java).toTypedArray()
)
Expand Down
Loading