I’ve made a quick demo (9 minutes) on the feature to demonstrate how to run a Web
application on WildFly with JBang, use MicroProfile Config and create a AI Chatbot:
On 26 Feb 2025, at 15:55, Jeff Mesnil <jmesnil(a)redhat.com>
wrote:
Hi,
I’ve opened a proposal[1] to be able to build and run WildFly application from JBang[2]
The goal of this proposal is to be able to quickly prototype WildFly applications from a
single .java file with no need to set up a Maven project, configure any plugins, etc.
TL;DR copy the file myapp.java:
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17+
//DEPS org.wildfly.bom:wildfly-expansion:${wildfly.version: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
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
@ApplicationPath("/")
public class myapp extends Application {
@Path("/hello")
@ApplicationScoped
public static class Hello {
@GET
public String sayHello() {
return "Hello, WildFly!";
}
}
}
You would then run `jbang run my app.java` et voila! You have your code running in a
WildFly server with all required capabilities as a Web archive.
The implementation is well under way and only impacts the WildFly Glow project.
The PR[3] for WildFly glow has also some documentation with working examples to prototype
a simple Web application, a MicroProfile application, and a Chat bot based on an Ollama
model.
This is an experimental feature.
I’m looking for volunteers to provide an outside perspective on this feature.
If you are interested by this proposal, please have a look at the proposal, the PR in
Glow
Thanks,
Jeff
[1]
https://github.com/wildfly/wildfly-proposals/pull/689
[2]
https://www.jbang.dev/
[3]
https://github.com/wildfly/wildfly-glow/pull/113
--
Jeff Mesnil
Engineer @ Red Hat
http://jmesnil.net/