Skip to content

conorheffron/ironoc-db

Repository files navigation

Java CI with Gradle

Proof HTML

Auto Assign

Sample Data Manager

================

Docker Hub

ironoc-db docker hub

Summary

This project is a sample data manager. It provides a basic template for Java/Spring developers. This project also includes form validation of controller model objects and request parameters. Users can view, add, delete person objects from the database via web UI.

Technologies Used

Java 21 (LTS Version), Spring Boot 3, Hibernate, MySQL or H2 databases supported, JSP, Gradle 8.10

Run

- See db.StarterDb.sql for sample Schema to get started with ironoc-db

MySql

docker pull mysql:latest
docker run -d --name test-mysql -e MYSQL_ROOT_PASSWORD=mypassword -p 3307:3306 mysql
docker logs test-mysql
docker exec -it test-mysql bash

create-db-connection create-test-schema load-db verify-db

Create Network

docker network create my-network
docker inspect network my-network 

Link mysql container to same network for access:

docker network connect my-network <mysql_container_name:test-mysql>

Inspect network configurations & update application properties with IPv4Address instead of localhost if mac user (IPv4Address for my-sql etc.)

  • Get IPv4Address from inspect cmd and test connection from MySql workbench with new host IP. Run StarterDb.sql.
docker inspect network my-network 

Build ironoc-db, run unit & integration tests, & generate war file.

gradle clean build

Run 'com.ironoc.db.App.java' directly from IntelliJ (can use localhost for spring.datasource.url) or via CLI (build & spin up docker image, use docker network IP address for test-mysql process):

docker image build -t ironoc-db .
docker compose up -d
docker logs ironoc-db-web-1 -f

Run locally with Gradle & H2 database

gradle bootRun --args='--spring.profiles.active=h2'

Run locally with Gradle & MySQL database

gradle bootRun --args='--spring.profiles.active=default'

docker-cli

Tear-down:

docker stop test-mysql
docker remove test-mysql

Alternatively, Docker Desktop is good if you prefer to not use the terminal/command line (CLI)

docker-desktop-containers

Can tail the logs by scrolling within the container logs:

docker-desktop-ironoc-db-logs

Screenshot Home

Home

Screenshot Form Validation Error for Add Person Call

ui-form-validation

Screenshot Form Validation Error for Delete Operation

ui-delete-validation