A Bootique Minimum Requirements Example

I'm putting together a really simple Bootique application and thought I'd use the opportunity to cover the minimum requirements of getting a Bootique App up and running. You will find much of the same information and more on the Bootique Getting Started page.


We'll start with the Maven POM requirements. We add a Bootique Parent and a Bootique Bill of Materials file to handle versioning.

Now we add any Bootique Modules we need. This is a really simple app so all we're going to add is a Bootique Logback Module as well as support for testing.

Using the Bootique Parent gives us several benefits including the Shade Plugin configuration for generating executable JARs, so our POM Shade config is real simple. A <main.class /> property and a <finalName /> optional Build property and we're good to go.

App Launcher Configuration

We'll next go to our application main() class which we're naming Launcher.class. What's happening here is that we're implementing Google Guice Module, creating a Bootique runtime, loading any Bootique modules and binding our classes. Our app is called KeyFix (won't bore you with its function), and to get started we are calling up an instance of a bound KeyFixUI Class and executing a method.

The Output

We're using the Bootique Logback Module, so no fighting amongst the Java Logging Libraries. It just works.


Bootique excels in testing support. Here is a simple @Test where we create our test environment as needed and confirm that our keyFixUI instance is not null.


So we build the application in Maven with $mvn clean install. SureFire runs our tests and Shade creates our keyfix.jar file. As you can see, we need to do little work in Bootique for a lot of gain. And better yet, because Bootique is "minimally opinionated" the FAT JAR is only 6MBs.