Created
June 14, 2025 05:46
-
-
Save ko-sasaki/f38dfe9fc7146268520cf72f333565e5 to your computer and use it in GitHub Desktop.
Revisions
-
ko-sasaki created this gist
Jun 14, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ ///usr/bin/env jbang "$0" "$@" ; exit $? package api; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; //DEPS org.springframework.boot:spring-boot-starter-web:3.5.0 //FILES application.yml //REPOS central,jitpack,google @SpringBootApplication @RestController public class SpringBootSample { @Value("${sample.message}") private String message; public static void main(String[] args) { SpringApplication.run(SpringBootSample.class, args); } /** * 固定メッセージを返却する. */ @GetMapping("/hello") public String hello() { return "Hello, World!"; } /** * URLパスで指定された文字列でメッセージを置換して返却する. */ @GetMapping("/hello/{name}") public String hello(@PathVariable String name) { return "Hello, {name}!".replace("{name}", name); } /** * application.ymlのメッセージを表示する */ @GetMapping("/hello/message") public String message() { return message; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ server: port: 8081 sample: message: Hello, Application Yaml!