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.

Restorante is configured entirely through src/main/resources/application.properties. There are no environment-specific YAML files or external configuration servers — every runtime setting lives in this single file. The sections below document each property, the database seeding system, CORS policy, and build dependencies.

Database Configuration

The full contents of application.properties as shipped with the project:
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

Property Reference

spring.application.name
string
default:"restorante-springboot"
The logical name of the application, surfaced in logs and Spring Boot Actuator metadata. Change this if you deploy multiple instances under different names.
spring.datasource.url
string
required
The JDBC connection string for the MySQL database. The proyectorestorante database must be created manually before the application starts — Hibernate will not create the database itself, only the tables within it. The serverTimeZone=UTC parameter prevents timezone mismatch errors between the JVM and MySQL server.
spring.datasource.url=jdbc:mysql://localhost:3306/proyectorestorante?serverTimeZone=UTC
spring.datasource.username
string
required
The MySQL user Restorante connects as. The default is root. For production deployments, create a dedicated database user with only the permissions the application requires.
spring.datasource.password
string
The password for the configured MySQL user. The shipped default is an empty string, which works when MySQL is running locally without a root password. Set this to your actual password before running the application.
spring.jpa.show-sql
boolean
default:"true"
When true, Hibernate prints every SQL statement it executes to standard output. This is useful during development to verify query behaviour, but produces substantial log noise. Set to false in production or staging environments.
spring.jpa.hibernate.ddl-auto
string
default:"update"
Controls how Hibernate manages the database schema on startup. The update value instructs Hibernate to compare the current schema against the entity model and apply additive changes (new tables, new columns). It does not drop or rename existing columns.
ValueBehaviour
updateAuto-migrates schema on startup. Safe for development.
validateValidates schema matches entities; fails fast if not. Recommended for production.
createDrops and recreates all tables on every startup. Data is lost.
create-dropLike create, but also drops tables when the context closes.
noneNo schema management. Fully manual.
spring.jpa.open-in-view
boolean
This property is commented out in the shipped configuration (#spring.jpa.open-in-view=false). When left at its Spring Boot default (true), the JPA EntityManager is kept open for the duration of the HTTP request, allowing lazy-loaded associations to be resolved inside Thymeleaf templates. Setting it to false enforces stricter transaction boundaries and is generally recommended for REST APIs, as it surfaces LazyInitializationException errors that would otherwise be silently deferred.
Do not use ddl-auto=update in production. The update strategy can miss destructive schema changes (column renames, type changes) and may leave your schema in an inconsistent state after model refactors. Use validate combined with a dedicated migration tool such as Flyway or Liquibase for production environments.

Database Seeding

Restorante ships with a InicializadorBD component (com.nicolasperez.restorantespringboot.config.InicializadorBD) that implements Spring Boot’s ApplicationRunner interface. It executes once immediately after the application context starts and seeds the database with a realistic set of sample data — but only when the personas table is completely empty. If any Persona records already exist, seeding is skipped entirely. The following records are inserted on first run:
EntityCountDetails
Gerente1Martín Vargas — manages the menu and pantry
Chef2Carina Sosa, Andrés Martínez
Mesero1Ana Martínez
Cliente1Pedro Sánchez
Ingrediente16Tomate, Cebolla, Ajo, Pasta, Queso Parmesano, and 11 more
Receta4Pasta Carbonara, Bistec a la Parrilla, Ensalada Caprese, Pollo al Horno
Alimento103 PlatoFuerte, 2 Postres, 3 Bebida, 2 Adicionales
Menu1”Menú Principal del Día” containing all 10 food items
Despensa1Linked to the Gerente, stocking all 16 ingredients
The seed data is idempotent with respect to application restarts — InicializadorBD checks personaRepository.count() > 0 before doing any work, so restarting the server never duplicates records.

CORS Configuration

All REST controllers in Restorante are annotated with @CrossOrigin("*"), which permits cross-origin requests from any origin. This means browser-based clients running on any domain can call the API without being blocked by the same-origin policy.
The wildcard CORS policy (*) is convenient for local development but should not be used in production. Restrict the allowed origins to the specific domain(s) that legitimately need access by replacing "*" with the appropriate origin URL, or by configuring a global CorsConfigurationSource bean.

Build Dependencies

Restorante is built with Gradle and uses the Spring Boot dependency management plugin. The following runtime and compile-time dependencies are declared in build.gradle:
DependencyScopePurpose
spring-boot-starter-webimplementationEmbedded Tomcat, Spring MVC, REST support
spring-boot-starter-data-jpaimplementationHibernate ORM, Spring Data repositories
spring-boot-starter-data-restimplementationHypermedia-driven REST endpoint generation
spring-boot-starter-thymeleafimplementationServer-side HTML templating for /menu and /despensa views
mysql-connector-jruntimeOnlyMySQL JDBC driver
lombokcompileOnly + annotationProcessorBoilerplate reduction (@Getter, @Setter, @Builder, etc.)
The project targets Java 21 via Gradle’s toolchain API:
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}
This ensures the correct JDK is used regardless of which Java version is active on the host machine, provided Gradle can locate or download a compatible toolchain.

Build docs developers (and LLMs) love