Skip to content

Feature #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This project serves as a boilerplate for building Java 17 applications using the
- [**Java 17**](https://www.oracle.com/br/java/technologies/downloads/): The latest long-term support version of Java, ensuring modern language features and improvements.
- [**Maven**](https://maven.apache.org/): Used for project management and dependency management.
- [**Docker Compose**](https://docs.docker.com/compose/): Simplifies local development by allowing you to run the entire application stack (including MySQL) within Docker containers.
- [**Dirk**](https://github.com/int4/dirk): A lightweight dependency injection library for managing object creation and dependencies.
- [**Dirk**](https://github.com/hjohn/Dirk): A lightweight dependency injection library for managing object creation and dependencies.
- [**SLF4J with Log4j2**](https://logging.apache.org/log4j/2.x/): Provides robust and flexible logging through the SLF4J API, using Log4j2 as the logging backend.
- [**JDBC**](https://docs.oracle.com/javase/tutorial/jdbc/): Utilized for establishing a connection to relational databases and performing SQL operations.
- [**MySQL Database**](https://www.mysql.com/): The database for storing and managing application data.
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
name: store-system
services:
# Java application
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
FROM mysql:8

# Uncomment the environment variables if are running the "docker build" command
ENV MYSQL_ROOT_PASSWORD=root
ENV MYSQL_DATABASE=store
ENV MYSQL_USER=admin
ENV MYSQL_PASSWORD=admin
# ENV MYSQL_ROOT_PASSWORD=root
# ENV MYSQL_DATABASE=store
# ENV MYSQL_USER=admin
# ENV MYSQL_PASSWORD=admin

# Copy the database initialization script to the container
COPY docker/init.sql /docker-entrypoint-initdb.d/
5 changes: 3 additions & 2 deletions src/main/java/com/elidaniel92/app/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ public Bootstrap(DatabaseConnection databaseConnection, Scheduler scheduler) {
public void initialize() {
log.info("Initializing all services...");
try {
databaseConnection.connect();
scheduler.start();
databaseConnection.connect();
} catch (SQLException e) {
log.error("Database connection failed, finishing application", e);
return;
}
scheduler.start();
}
}
Loading