Created
March 13, 2025 09:56
-
-
Save jmesnil/b0f05ca66648824a1ebb52cb4b7f7de4 to your computer and use it in GitHub Desktop.
Simple MicroProfile application with WildFly & JBang
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 $? | |
//DEPS com.github.lalyos:jfiglet:0.0.8 | |
//DEPS org.wildfly.bom:wildfly-expansion:35.0.1.Final@pom | |
//DEPS jakarta.ws.rs:jakarta.ws.rs-api | |
//DEPS jakarta.enterprise:jakarta.enterprise.cdi-api | |
//DEPS org.eclipse.microprofile.config:microprofile-config-api | |
//DEPS org.wildfly.glow:wildfly-glow:1.3.2.Final | |
import jakarta.enterprise.context.ApplicationScoped; | |
import jakarta.ws.rs.*; | |
import jakarta.ws.rs.core.*; | |
import com.github.lalyos.jfiglet.FigletFont; | |
import jakarta.inject.Inject; | |
import org.eclipse.microprofile.config.inject.ConfigProperty; | |
@ApplicationPath("/") | |
public class myapp extends Application { | |
@Path("/hello") | |
@ApplicationScoped | |
public static class Hello { | |
@Inject | |
@ConfigProperty(name = "hello", defaultValue = "Hello") | |
String helloWord; | |
@GET | |
public String sayHello(@QueryParam("name") @DefaultValue("World") String name) throws Exception { | |
String hello = String.format("%s, %s!", helloWord, name); | |
return FigletFont.convertOneLine(hello); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment