Application Properties
The main configuration file is located atsrc/main/resources/application.properties. All settings can be overridden using environment variables.
Application Name
Database Configuration
Server Configuration
Port and Context Path
Configure the server port and base API path:| Property | Default | Description |
|---|---|---|
server.port | 8080 | HTTP port the server listens on. Reads from PORT environment variable if available |
server.servlet.context-path | /api | Base path for all API endpoints |
server.address | 0.0.0.0 | Network interface to bind to. 0.0.0.0 allows external access |
All API endpoints will be prefixed with
/api. For example, the vehicles endpoint will be accessible at /api/vehicles.Configuration Options Reference
Database Properties
JPA/Hibernate Properties
| Property | Value | Description |
|---|---|---|
spring.jpa.hibernate.ddl-auto | update | Schema generation strategy. Options: create, create-drop, update, validate, none |
spring.jpa.show-sql | true | Log SQL statements to console |
spring.jpa.properties.hibernate.format_sql | true | Format logged SQL for readability |
spring.jpa.database-platform | org.hibernate.dialect.MySQLDialect | Hibernate dialect for MySQL optimization |
Environment-Specific Configuration
Development
Development mode enables SQL logging and automatic schema updates for faster iteration.
Production
Using Environment Variables
All Spring Boot properties can be overridden with environment variables by converting the property name:- Convert to uppercase
- Replace dots (
.) with underscores (_) - Replace hyphens (
-) with underscores (_)
| Property | Environment Variable |
|---|---|
spring.datasource.url | SPRING_DATASOURCE_URL |
spring.datasource.username | SPRING_DATASOURCE_USERNAME |
server.port | SERVER_PORT |
spring.jpa.show-sql | SPRING_JPA_SHOW_SQL |
Docker Example
Dependencies
The following key dependencies are configured inpom.xml:
- Spring Boot 4.0.0 - Application framework
- Spring Data JPA - Database access and ORM
- MySQL Connector/J - MySQL JDBC driver
- Spring Security Crypto - Password hashing
- Lombok 1.18.42 - Boilerplate reduction
- Spring Boot DevTools - Development utilities
Next Steps
Database Setup
Learn how to set up and configure the DriveX database schema
Deployment
Deploy the DriveX Backend API to production