A Spring Boot application built with Java 17, Spring Data JPA, and H2 database.
- Prerequisites
- Technology Stack
- Project Structure
- Configuration
- How to Run
- Accessing the Application
- Development
- Testing
- Troubleshooting
Before running this application, ensure you have the following installed:
-
Java 17 or higher
- Check version:
java -version - Download from: Oracle JDK or OpenJDK
- Check version:
-
Maven (Optional - Maven wrapper is included)
- The project includes Maven wrapper (
mvnwfor Unix/Mac,mvnw.cmdfor Windows) - If you prefer to use your own Maven installation, ensure Maven 3.6+ is installed
- The project includes Maven wrapper (
- Spring Boot: 4.0.0
- Java: 17
- Database: H2 (in-memory)
- ORM: Spring Data JPA / Hibernate
- Build Tool: Maven 3.9.11
- Additional Libraries:
- Lombok (for reducing boilerplate code)
- Spring Validation
- Spring Web MVC
firstclub/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/org/firstclub/
│ │ │ └── FirstclubApplication.java
│ │ └── resources/
│ │ ├── application.properties
│ │ ├── static/
│ │ └── templates/
│ └── test/
│ └── java/
│ └── com/org/firstclub/
│ └── FirstclubApplicationTests.java
├── pom.xml
├── mvnw (Maven wrapper for Unix/Mac)
├── mvnw.cmd (Maven wrapper for Windows)
└── README.md
The application is configured via src/main/resources/application.properties:
- Server Port: 8080
- Database: H2 in-memory database
- URL:
jdbc:h2:mem:firstclubdb - Username:
sa - Password: (empty)
- URL:
- H2 Console: Enabled at
/h2-console - JPA: Auto-update schema, SQL logging enabled
# Make the wrapper executable (first time only)
chmod +x mvnw
# Run the application
./mvnw spring-boot:runmvnw.cmd spring-boot:runmvn spring-boot:run# Unix/Mac/Linux
./mvnw clean package
# Windows
mvnw.cmd clean packagejava -jar target/firstclub-0.0.1-SNAPSHOT.jar- Import the project as a Maven project in your IDE (IntelliJ IDEA, Eclipse, VS Code)
- Locate the main class:
com.org.firstclub.FirstclubApplication - Right-click and select "Run" or "Debug"
Once the application starts successfully, you'll see output similar to:
Started FirstclubApplication in X.XXX seconds
- Application Base URL: http://localhost:8080
- H2 Database Console: http://localhost:8080/h2-console
- JDBC URL:
jdbc:h2:mem:firstclubdb - Username:
sa - Password: (leave empty)
- JDBC URL:
Currently, the application is a skeleton project. You can verify it's running by:
- Checking the console logs for "Started FirstclubApplication"
- Accessing the H2 console at http://localhost:8080/h2-console
The project structure follows standard Spring Boot conventions:
- Controllers: Create in
src/main/java/com/org/firstclub/controller/ - Services: Create in
src/main/java/com/org/firstclub/service/ - Repositories: Create in
src/main/java/com/org/firstclub/repository/ - Entities: Create in
src/main/java/com/org/firstclub/entity/ormodel/ - DTOs: Create in
src/main/java/com/org/firstclub/dto/
The project includes Lombok. Common annotations:
@Data- Generates getters, setters, toString, equals, hashCode@NoArgsConstructor- Generates no-args constructor@AllArgsConstructor- Generates all-args constructor@Builder- Implements builder pattern
Add Spring Boot DevTools for automatic restart during development:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency># Unix/Mac/Linux
./mvnw test
# Windows
mvnw.cmd test./mvnw test -Dtest=FirstclubApplicationTests./mvnw clean test jacoco:reportSolution: Change the port in application.properties:
server.port=8081Error: Unsupported class file major version XX
Solution: Ensure Java 17 is installed and set as JAVA_HOME:
# Check Java version
java -version
# Set JAVA_HOME (Unix/Mac)
export JAVA_HOME=/path/to/java17
# Set JAVA_HOME (Windows)
set JAVA_HOME=C:\path\to\java17Solution (Unix/Mac):
chmod +x mvnwSolution: Ensure your IDE has Lombok plugin installed:
- IntelliJ IDEA: Install "Lombok" plugin and enable annotation processing
- Eclipse: Install Lombok from https://projectlombok.org/
- VS Code: Install "Lombok Annotations Support" extension
Solution: Verify these settings in application.properties:
spring.h2.console.enabled=true
spring.h2.console.path=/h2-consoleIf you encounter build issues, try a clean build:
./mvnw clean install./mvnw clean package -DskipTests./mvnw spring-boot:run -Dspring-boot.run.profiles=dev./mvnw dependency:tree./mvnw versions:display-dependency-updatesThis is a skeleton Spring Boot application. To build a complete application, consider adding:
- REST Controllers for your API endpoints
- JPA Entities for your data models
- Service layer for business logic
- Repository interfaces for data access
- Exception handling
- Security configuration (Spring Security)
- API documentation (Swagger/OpenAPI)
- Additional tests (unit and integration tests)
For Spring Boot documentation, visit:
Version: 0.0.1-SNAPSHOT
Last Updated: 2025-11-24