Banco Alimentos ships with a multi-stageDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/alvarezlautaro/BancoAlimentos/llms.txt
Use this file to discover all available pages before exploring further.
Dockerfile and a docker-compose.yml that wire up the Spring Boot application and a MySQL 8 database together. For local development you can also run the application directly with the Maven wrapper, pointing it at any MySQL instance you already have running.
Method 1 — Docker Compose (recommended)
Docker Compose is the simplest way to get a fully working stack. A single command builds the application image and starts both the database and application services.The compose file
docker-compose.yml
app service will not start until MySQL passes its health check, so you do not need to worry about connection-refused errors during startup.
Providing environment variables
All required values are read from the environment at runtime. The recommended approach is a.env file in the project root — Docker Compose picks it up automatically:
.env
-d flag:
Method 2 — Local Maven
If you already have MySQL 8 running locally, you can start the application with the Spring Boot Maven plugin without touching Docker.Prerequisites
- JDK 21 or later (set
JAVA_HOMEaccordingly) - Maven 3.9+ or use the included
./mvnwwrapper (no separate Maven installation required) - A running MySQL 8 instance with a database named
Banco_Alimentos(or the name of your choice, supplied viaDB_URL)
Run the application
Export environment variables in your shell, then start the application:Run with Maven wrapper
Run on Windows
Environment variable reference
All configurable values are listed below. Every variable has a fallback default baked intoapplication.yaml, so the application will start even if only some variables are supplied — but you should override at minimum the JWT secret in any non-local environment.
| Variable | Default | Description |
|---|---|---|
DB_URL | jdbc:mysql://localhost:3306/Banco_Alimentos | Full JDBC connection URL for the MySQL database. In Docker Compose the host is the service name mysql. |
DB_USER | root | MySQL user the application connects as. |
DB_PASSWORD | root | Password for DB_USER. |
JWT_SECRET | 5a8d7f8b2c3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f | Hex string used to sign and verify JWT tokens. Must be kept secret. |
JWT_EXPIRATION | 86400000 | Token validity period in milliseconds. The default is 24 hours (86 400 000 ms). |
Schema management
The application uses Hibernate’sddl-auto: create-drop strategy by default. This means:
- The database schema is created on startup.
- All data — including the seed users from
DataInitializer— is dropped when the application shuts down.
For a persistent schema that survives restarts, change the
ddl-auto value to update in application.yaml (or set it via a Spring property override). With update, Hibernate applies only the incremental DDL changes needed to match the current entity model and leaves existing data intact.application.yaml — switch to persistent schema
When running with
create-drop the DataInitializer re-seeds the three default user accounts (deposito, tesoreria, institucional) on every startup. When switching to update, run DataInitializer only once or add a guard to prevent it from duplicating records.