diff --git a/examples/java/src/main/java/com/grafana/example/RollController.java b/examples/java/src/main/java/com/grafana/example/RollController.java index e2132bc..f537a91 100644 --- a/examples/java/src/main/java/com/grafana/example/RollController.java +++ b/examples/java/src/main/java/com/grafana/example/RollController.java @@ -11,6 +11,7 @@ @RestController public class RollController { + private static final Logger logger = LoggerFactory.getLogger(RollController.class); @GetMapping("/rolldice") diff --git a/examples/java/src/main/java/com/grafana/example/SpringBootApp.java b/examples/java/src/main/java/com/grafana/example/SpringBootApp.java index 7a2139d..7501b5a 100644 --- a/examples/java/src/main/java/com/grafana/example/SpringBootApp.java +++ b/examples/java/src/main/java/com/grafana/example/SpringBootApp.java @@ -1,11 +1,24 @@ package com.grafana.example; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; @SpringBootApplication +@RestController public class SpringBootApp { + /** + * Redirect to {@link RollController} + */ + @GetMapping("/") + public void redirect(HttpServletResponse httpServletResponse) { + httpServletResponse.setHeader("Location", "/rolldice"); + httpServletResponse.setStatus(302); + } + public static void main(String[] args) { SpringApplication.run(SpringBootApp.class, args); }