Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/NicolasMPP/restorante-springboot/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through everything required to get a working Restorante instance running on your local machine — from installing prerequisites and creating the MySQL database, to booting the application and querying the menu API for the first time. By the end you will have a fully seeded database and a live REST API responding on localhost:8080.
1

Prerequisites

Ensure you have the following installed before proceeding:
  • Java 21 or later — Restorante’s build.gradle targets JavaLanguageVersion.of(21).
  • MySQL 8 or later — the application connects to a local MySQL instance.
  • Gradle — or use the included gradlew wrapper (no separate installation required).
Verify your Java version:
java -version
You should see output indicating 21 or a higher version, for example:
openjdk version "21.0.3" 2024-04-16
2

Clone the Repository

Clone the project from GitHub and enter the project directory:
git clone https://github.com/NicolasMPP/restorante-springboot.git && cd restorante-springboot
The project uses the Gradle wrapper, so no separate Gradle installation is needed — all subsequent commands use ./gradlew (macOS/Linux) or gradlew.bat (Windows).
3

Create the MySQL Database

Restorante does not create the database schema itself — you must create the database first. Connect to your MySQL instance and run:
CREATE DATABASE proyectorestorante
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;
Once the database exists, Hibernate will automatically create and migrate all required tables on first startup thanks to the spring.jpa.hibernate.ddl-auto=update setting.
4

Configure application.properties

Open src/main/resources/application.properties and supply your MySQL credentials. The file ships with the following defaults:
spring.application.name=restorante-springboot

spring.datasource.url=jdbc:mysql://localhost:3306/proyectorestorante?serverTimeZone=UTC
spring.datasource.username=root
spring.datasource.password=

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
#spring.jpa.open-in-view=false
The spring.datasource.password is empty by default, which works when MySQL is running locally without a root password. If your MySQL instance requires a password, set it here (or configure a dedicated application user). The ddl-auto=update setting instructs Hibernate to inspect the schema on startup and apply any missing table or column definitions automatically — no manual SQL migrations are needed in development.
If MySQL is running on a non-standard port or a remote host, update the spring.datasource.url accordingly. The serverTimeZone=UTC parameter avoids timezone mismatch errors between the JVM and MySQL.
5

Run the Application

Start the application using the Gradle wrapper:
./gradlew bootRun
On first run, the InicializadorBD component executes automatically and seeds the database with a complete set of sample data. You will see output similar to:
============================================================
🗄️  INICIALIZANDO BASE DE DATOS
============================================================
📦 Base de datos vacía. Insertando datos de prueba...
  + Ingrediente: Tomate
  + Ingrediente: Cebolla
  ...
  + Receta: Pasta Carbonara
  + Receta: Bistec a la Parrilla
  ...
  + Alimento: Pasta Carbonara Premium
  ...
  + Menú: Menú Principal del Día
  + 10 alimentos asociados al menú
  + Despensa creada para gerente: Martín Vargas
  + 16 ingredientes asociados a la despensa
✅ Base de datos inicializada correctamente.
============================================================
On subsequent startups, InicializadorBD detects that the personas table is non-empty and skips seeding. The server starts on port 8080 by default.
6

Make Your First API Call

With the server running, fetch the seeded menu by its ID:
curl http://localhost:8080/api/menu/1
You should receive a JSON response similar to:
{
  "id": 1,
  "nombreMenu": "Menú Principal del Día",
  "alimentos": [
    {
      "id": 1,
      "nombre": "Pasta Carbonara Premium",
      "precio": 18.50,
      "tipo": "PLATO_FUERTE"
    },
    {
      "id": 2,
      "nombre": "Bistec Angus 300g",
      "precio": 25.00,
      "tipo": "PLATO_FUERTE"
    },
    {
      "id": 7,
      "nombre": "Coca-Cola",
      "precio": 3.50,
      "tipo": "BEBIDA"
    }
  ]
}
The Thymeleaf web interface is also available once the server is running:Navigating to http://localhost:8080/ redirects automatically to /menu.

Next Steps

Configuration

Deep-dive into every application.properties setting, database seeding behavior, and CORS configuration.

Data Model

Understand the Persona and Alimento inheritance hierarchies and how entities relate to one another.

Menu API

Browse all REST endpoints for creating, reading, and managing menus and food items.

Build docs developers (and LLMs) love