Java - Spring + MySQL
Spring is a framework for Java, optimal for web applications as it is optimized to run multiple services in parallel and securely in a RESTful way. It is also compatible with other Java frameworks.
MySQL is an open-source relational database management system widely used that allows storing, organizing and retrieving data efficiently. Developed by Oracle, MySQL offers high speed and reliability, facilitating data management through SQL queries. Its scalability, support for multiple platforms and ability to integrate with numerous programming languages make it a popular choice for web and enterprise applications. MySQL is highly customizable and has an active community of developers who contribute to its continuous improvement.
Project structure
.
βββ app
βΒ Β βββ pom.xml
βΒ Β βββ src
βΒ Β βΒ Β βββ main
βΒ Β βΒ Β βββ java
βΒ Β βΒ Β βΒ Β βββ com
βΒ Β βΒ Β βΒ Β βββ company
βΒ Β βΒ Β βΒ Β βββ project
βΒ Β βΒ Β βΒ Β βββ Application.java
βΒ Β βΒ Β βΒ Β βββ configuration
βΒ Β βΒ Β βΒ Β βΒ Β βββ DockerSecretsProcessor.java
βΒ Β βΒ Β βΒ Β βββ controllers
βΒ Β βΒ Β βΒ Β βΒ Β βββ HomeController.java
βΒ Β βΒ Β βΒ Β βββ entity
βΒ Β βΒ Β βΒ Β βΒ Β βββ Greeting.java
βΒ Β βΒ Β βΒ Β βββ repository
βΒ Β βΒ Β βΒ Β βββ GreetingRepository.java
βΒ Β βΒ Β βββ resources
βΒ Β βΒ Β βββ application.properties
βΒ Β βΒ Β βββ data.sql
βΒ Β βΒ Β βββ META-INF
βΒ Β βΒ Β βΒ Β βββ spring.factories
βΒ Β βΒ Β βββ schema.sql
βΒ Β βββ target
βΒ Β βββ classes
βΒ Β βββ application.properties
βΒ Β βββ com
βΒ Β βΒ Β βββ company
βΒ Β βΒ Β βββ project
βΒ Β βΒ Β βββ Application.class
βΒ Β βΒ Β βββ configuration
βΒ Β βΒ Β βΒ Β βββ DockerSecretsProcessor.class
βΒ Β βΒ Β βββ controllers
βΒ Β βΒ Β βΒ Β βββ HomeController.class
βΒ Β βΒ Β βββ entity
βΒ Β βΒ Β βΒ Β βββ Greeting.class
βΒ Β βΒ Β βββ repository
βΒ Β βΒ Β βββ GreetingRepository.class
βΒ Β βββ data.sql
βΒ Β βββ META-INF
βΒ Β βΒ Β βββ spring.factories
βΒ Β βββ schema.sql
βββ app.Dockerfile
βββ compose.yaml
βββ db
βΒ Β βββ password.txt
βββ README.txt
Application deployment:
We change to the directory that contains the files needed to build the container:
cd /root/stack/python/nextjs
And start the application:
docker compose up -d
Useful commands:
View the containers that are running:
docker compose ps
Stop and remove the application:
docker compose down
Rebuild the application after making changes to the code:
docker compose --build -d