5 minutes
Devoxx BE 2025: It Only Starts with a Container & How Abstraction Becomes Reality
At Devoxx Belgium 2025, I was able to talk about what happens after you build your container. In theory, […]
Jakarta EE offers a reliable foundation for enterprise-scale Java applications. Sometimes, however, the traditional deployment model can add a layer of complexity. Payara Micro addresses this challenge by providing a streamlined approach for managing your Jakarta EE deployments.
Let’s first explore why you would want to embed Payara Micro directly into your application:
Adding Payara Micro to your project is straightforward. Let’s assume you’re using a build system like Maven or Gradle.
Include the following dependency in your project’s pom.xml (for Maven) or build.gradle (for Gradle).
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-micro</artifactId>
<version>6.2024.2</version>
</dependency>
You can package your application (WAR file) alongside the Payara Micro libraries. With a few lines of code, the deployment happens seamlessly as part of the application startup:
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
public class MyApplication {
public static void main(String[] args) throws BootstrapException {
PayaraMicro.getInstance()
.addDeployment("/path/to/my-application.war")
.bootstrap();
}
}
Perhaps you want more flexibility to deploy applications after your instance is running. You can achieve that with Payara Micro as follows.
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicroRuntime;
public class MyApplication {
public static void main(String[] args) throws BootstrapException {
PayaraMicroRuntime runtime = PayaraMicro.bootstrap();
// ...later, when you're ready to deploy...
runtime.deploy("my-application", new FileInputStream("/path/to/my-application.war"));
}
}
Use the run method for targeted or cluster-wide deployment of the asadmin command on multiple Payara Micro instances. This method offers two variants:
Subset Deployment: Run the command on chosen instances.
Cluster-wide Deployment: Run the command on all instances.
PayaraMicroRuntime runtime = PayaraMicro.getInstance().setHttpAutoBind(true).bootstrap();
runtime.run("deploy", "/path/to/my-application.war");
Payara Micro also plays nicely with Maven repositories. Deploy applications directly from Maven coordinates by simply specifying the group ID, artifact ID, and version as follows.
PayaraMicro.getInstance()
.addDeployFromGAV("com.example,my-application,1.0.0")
.bootstrap();
For broader artefact searches, Payara Micro allows you to specify additional Maven repositories. Use the addRepoUrl() method for this customization. For instance;
PayaraMicro.getInstance()
.addRepoUrl("https://nexus.payara.fish/repository/payara-artifacts")
.addDeployFromGAV("fish.payara.testing,clusterjsp,1.1")
.bootStrap();
Traditional Jakarta EE deployment methods can sometimes feel overly complex. Payara Micro offers a simplified solution by embedding the Jakarta EE runtime directly within your Java applications. This approach provides several key benefits:
Ready to transform your Jakarta EE development experience? Download Payara Micro today and discover the power of simplified deployments, flexibility, and control within your Java codebase. Simplify and accelerate your enterprise projects with Payara Micro.
Share:
5 minutes
At Devoxx Belgium 2025, I was able to talk about what happens after you build your container. In theory, […]
5 minutes
Welcome aboard the October issue of The Monthly Catch!As the leaves turn and conference season hits full stride, the […]
5 minutes
Payara Cloud is becoming part of Payara Qube family of Java application deployment runtimes. This move reflects how the […]