Skip to main content

Running with Maven

The simplest way to run the application is using Maven Wrapper:
The application will start on http://localhost:8080
The first run may take longer as Maven downloads dependencies.

With Specific Profile

Run with a specific Spring profile:

With Environment Variables

Pass environment variables at runtime:

Running from IDE

IntelliJ IDEA

1

Import the project

  • Open IntelliJ IDEA
  • Select File → Open
  • Navigate to the project directory and select pom.xml
  • Choose Open as Project
2

Wait for Maven import

IntelliJ will automatically import Maven dependencies. Wait for the process to complete.
3

Run the application

  • Navigate to src/main/java/com/tecmilenio/edutec/EdutecApplication.java
  • Right-click on the file or the main method
  • Select Run ‘EdutecApplication’
4

Configure run settings (optional)

  • Click Run → Edit Configurations
  • Set environment variables, VM options, or active profiles
  • Example: Add SPRING_PROFILES_ACTIVE=dev to environment variables

Eclipse

1

Import Maven project

  • File → Import → Maven → Existing Maven Projects
  • Browse to the project directory
  • Click Finish
2

Run as Spring Boot App

  • Right-click on the project
  • Select Run As → Spring Boot App

Visual Studio Code

1

Open the project folder

  • File → Open Folder
  • Select the project directory
2

Install recommended extensions

VS Code will prompt to install Java and Spring extensions. Accept the recommendations.
3

Run the application

  • Open EdutecApplication.java
  • Click Run or Debug above the main method
  • Or press F5 to start debugging

Building the JAR

Create an executable JAR file for deployment:
This creates a JAR file at: target/com.escolar-0.0.1-SNAPSHOT.jar
Use -DskipTests to skip tests during build: ./mvnw clean package -DskipTests

Running the JAR

Once built, run the JAR directly:
With environment variables:
With Spring profile:

Accessing the Application

Once the application starts, you’ll see:
The API is now available at:
  • Base URL: http://localhost:8080
  • H2 Console (if enabled): http://localhost:8080/h2-console
  • Swagger UI (if configured): http://localhost:8080/swagger-ui.html

Testing Endpoints

Using cURL

Test the authentication endpoint:
Expected Response: A JWT token string

Using Postman

1

Create a new request

  • Method: POST
  • URL: http://localhost:8080/auth/login
2

Set headers

Add header:
3

Set request body

Select Body → raw → JSON and enter:
4

Send the request

Click Send and view the JWT token in the response.

Using HTTPie

A more user-friendly alternative to cURL:

Hot Reload with DevTools

The project includes Spring Boot DevTools for automatic application restart during development.

How It Works

  • Automatic Restart: When you modify and save Java files, the application automatically restarts
  • LiveReload: Browser auto-refresh when static resources change (requires browser extension)
  • Property Defaults: Optimized default properties for development

Triggering a Restart

1

Make code changes

Modify any Java file in your IDE
2

Save the file

The application will detect changes and restart automatically
3

Wait for restart

Watch the console for:
Changes to pom.xml or configuration files require a full manual restart.

Troubleshooting Common Issues

Port Already in Use

Error: Web server failed to start. Port 8080 was already in use. Solution 1: Kill the process using port 8080
Solution 2: Change the port in application.properties

Database Connection Failed

Error: Cannot create PoolableConnectionFactory Solutions:
  • Verify MySQL is running: systemctl status mysql (Linux) or check Services (Windows)
  • Check database credentials in application.properties
  • Ensure database exists: CREATE DATABASE edutec;
  • Switch to H2 for development (see Configuration)

JDBC Driver Not Found

Error: No suitable driver found for jdbc:mysql://... Solution: Ensure MySQL connector dependency is in pom.xml and rebuild:

Java Version Mismatch

Error: Unsupported class file major version Solution: Verify Java 8 is being used:
Set JAVA_HOME if needed:

Maven Build Failed

Error: Various build errors Solutions:

Application Starts but Endpoints Return 404

Possible Causes:
  • Controller not scanned by Spring Boot
  • Incorrect request mapping
  • Context path configured
Debug Steps:
  1. Check application logs for registered mappings:
  1. Verify controller package is under com.tecmilenio.edutec
  2. Check if context path is set in application.properties

H2 Console Not Accessible

Solution: Enable H2 console in application.properties:

Performance Tips

Faster Builds: Use ./mvnw clean package -DskipTests -Dmaven.test.skip=true during active development.
Reduce Startup Time: Disable unused auto-configurations in application.properties:
Debug Mode: Run with debug logging to troubleshoot issues:

Useful Development Commands

Next Steps

Authentication API

Test the login endpoint

User Model

Explore the User entity

Configuration

Application configuration guide

Architecture

Understand the system architecture