Application Configuration Overview
The EduTec Backend uses Spring Boot’s configuration system, with settings defined inapplication.properties located at src/main/resources/application.properties.
Default Configuration
The baseapplication.properties file contains minimal configuration:
src/main/resources/application.properties
Most configuration is currently using Spring Boot defaults. You’ll need to add database and other settings for production use.
Database Configuration
Development with H2 (In-Memory)
For quick development without MySQL setup, use H2 in-memory database. Add toapplication.properties:
Production with MySQL
For MySQL database connection, configure:DDL Auto Modes
Thespring.jpa.hibernate.ddl-auto property controls database schema generation:
JWT Configuration
Current Implementation
The JWT secret key is currently hardcoded inJwtService.java:
src/main/java/com/tecmilenio/edutec/security/JwtService.java
Recommended: Environment Variable Configuration
To properly secure the JWT secret, modifyJwtService.java to read from configuration:
- Add to
application.properties:
- Update
JwtService.javato use@Valueannotation:
- Set environment variable:
Server Configuration
Configure the embedded Tomcat server:Spring Profiles
Use Spring profiles to manage different environments:Create Profile-Specific Files
application-dev.properties (Development):
application-prod.properties (Production):
Activate Profiles
Mail Configuration (Optional)
The project includes Spring Mail. To enable email functionality:Session Management
The project uses JDBC session management:Complete Example Configuration
Here’s a completeapplication.properties for local development:
Environment Variables Best Practices
1
Never commit secrets
Use
.gitignore to exclude files containing sensitive data:2
Use environment variables for sensitive data
- Database passwords:
${DB_PASSWORD} - JWT secrets:
${JWT_SECRET} - API keys:
${API_KEY}
3
Document required variables
Create a
.env.example file with placeholder values:4
Use different values per environment
Development, staging, and production should have separate credentials.
Next Steps
Running Locally
Start the application with your configuration
API Reference
Explore available API endpoints