Skip to main content

Application Configuration Overview

The EduTec Backend uses Spring Boot’s configuration system, with settings defined in application.properties located at src/main/resources/application.properties.

Default Configuration

The base application.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 to application.properties:
Access the H2 console at http://localhost:8080/h2-console with JDBC URL jdbc:h2:mem:edutecdb and username sa.

Production with MySQL

For MySQL database connection, configure:

DDL Auto Modes

The spring.jpa.hibernate.ddl-auto property controls database schema generation:
Never use create or create-drop in production as it will delete all data!

JWT Configuration

Current Implementation

The JWT secret key is currently hardcoded in JwtService.java:
src/main/java/com/tecmilenio/edutec/security/JwtService.java
Security Risk: The JWT secret key is hardcoded in the source code. This should be moved to environment variables before deployment.
To properly secure the JWT secret, modify JwtService.java to read from configuration:
  1. Add to application.properties:
  1. Update JwtService.java to use @Value annotation:
  1. Set environment variable:
Generate a secure random key: openssl rand -base64 32

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 complete application.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