From 78761085fab6ac9db76772394eefef1ffe6e69da Mon Sep 17 00:00:00 2001 From: ardetrick <1452182+ardetrick@users.noreply.github.com> Date: Mon, 13 Jul 2026 20:22:15 -0600 Subject: [PATCH] feat: log the demo url once dev-time startup completes --- .../TestOryHydraReferenceApplication.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/reference-app/src/test/java/com/ardetrick/oryhydrareference/TestOryHydraReferenceApplication.java b/reference-app/src/test/java/com/ardetrick/oryhydrareference/TestOryHydraReferenceApplication.java index 6a56af9..b7afc6a 100644 --- a/reference-app/src/test/java/com/ardetrick/oryhydrareference/TestOryHydraReferenceApplication.java +++ b/reference-app/src/test/java/com/ardetrick/oryhydrareference/TestOryHydraReferenceApplication.java @@ -2,8 +2,11 @@ import com.ardetrick.testcontainers.OryHydraContainer; import java.util.List; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; +import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Bean; /** @@ -11,8 +14,8 @@ * seeded demo client, so running locally is one command with nothing to install but Docker. * *

Run {@code ./gradlew bootTestRun}, then open http://localhost:8080/demo and log in with {@code - * foo@bar.com} / {@code password}. + * href="http://localhost:8080">http://localhost:8080 and log in with {@code foo@bar.com} / + * {@code password}. */ public class TestOryHydraReferenceApplication { @@ -22,9 +25,20 @@ public static void main(String[] args) { .run(args); } + @Slf4j @TestConfiguration(proxyBeanMethods = false) static class LocalHydraConfiguration { + // End the startup logs with the link to click — the convention of one-command dev servers. + // Dev-time only: the production app cannot know its public URL, but this configuration + // already pins every port, so it can. + @Bean + ApplicationListener readyMessage() { + return event -> + log.info( + "Demo ready — open http://localhost:8080 and log in with foo@bar.com / password"); + } + // Hydra's host ports are pinned to the image defaults here, so Hydra's dev-mode issuer // (http://localhost:4444), the app's default admin base path (http://localhost:4445), and // the hardcoded links on /demo all line up with no configuration. Unlike the functional