Java ee microservices starter-kit with payara-micro and docker

View project on GitHub

Java EE micro service starter kit with docker, payara micro, arquillian on AWS Cloud

  • This is complete example how to setup java ee ready for micro service AWS Cloud deployment with AWS elastic beanstalk and AWS Code pipeline via AWS Code Build


  1. JDK 1.8
  2. Gradle 3.x
  3. Docker
  4. AWS Cli

Setting up properties

Before changing properties you need to setup:

  • AWS IAM user account with Elastic Beanstalk / EC2 Container read write permissions.
    "Version": "2012-10-17",
    "Statement": [
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
            "Resource": "arn:aws:s3:::elasticbeanstalk-*"
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
            "Resource": "*"
  • EC2 Container Registry and Elastic Beanstalk Single environment application with docker engine

Change aws config in


Building project

gradle clean build -Penv=local

Starting embedded server

Server will be running on default port 8080

gradle startServer

Starting unit tests:

gradle test

Starting integration test with arquillian:

Before tests docker compose hast to be started because you may need an local data store which you can run in docker.

Run compose once:

gradle dockerCompose

Then start tests:

gradle itest

Starting/stopping docker server

gradle startDocker
gradle stopDoker

Publishing to ecr repository

This command creates elastic beanstalk application deployment version and publish baked container to EC2 Container Repository:

gradle clean publishToECR -Penv=prod 

Example running apps manually:

You can simply run them as jar applications or you can configure your ide to run jar application so you can debug it.

gradle build -Penv=local
java -jar ./pajara-micro.jar --deploy ./build/libs/starter-1.0.0.war

note if you did not download payara micro run

gradle downloadPayaraMicro