Last active
March 5, 2025 14:13
-
-
Save jmesnil/4682524df0e0afcf0d187a38b26be921 to your computer and use it in GitHub Desktop.
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 characters
///usr/bin/env jbang "$0" "$@" ; exit $? | |
//JAVA 17+ | |
//DEPS org.wildfly.bom:wildfly-expansion:35.0.1.Final@pom | |
//DEPS org.wildfly.glow:wildfly-glow:1.3.2.Final | |
//DEPS jakarta.ws.rs:jakarta.ws.rs-api | |
//DEPS jakarta.enterprise:jakarta.enterprise.cdi-api | |
//DEPS org.eclipse.microprofile.config:microprofile-config-api | |
import jakarta.enterprise.context.ApplicationScoped; | |
import jakarta.inject.Inject; | |
import jakarta.ws.rs.GET; | |
import jakarta.ws.rs.Path; | |
import jakarta.ws.rs.ApplicationPath; | |
import jakarta.ws.rs.core.Application; | |
import org.eclipse.microprofile.config.inject.ConfigProperty; | |
@ApplicationPath("/") | |
public class app extends Application { | |
@Path("/hello") | |
@ApplicationScoped | |
public static class Hello { | |
@Inject | |
@ConfigProperty(name = "nick.name", defaultValue = "Alice") | |
private String name; | |
@GET | |
public String sayHello() { | |
return String.format("Hello, %s!", name); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment