Project and Next Steps · Lesson 42 of 42
Next Steps: Maven, JUnit and Spring Boot
You now know core Java: syntax, OOP, collections, streams, exceptions, files and concurrency. That is the foundation every Java job assumes. Companies hiring freshers for Java roles then look for four more things: a build tool, unit tests, databases and Spring Boot. This lesson gives you a first working look at each, and a realistic plan to become job-ready.
In this lesson
- Maven: project structure and dependencies
- Unit testing with JUnit 5
- Databases with JDBC and SQL
- Your first Spring Boot REST API, and a 12-week roadmap
The path from here
From core Java to a backend developer job
- Core Javathis course ✓
- Build & testMaven or Gradle, JUnit 5, Git
- DataSQL, JDBC, then JPA/Hibernate
- Spring BootREST APIs, validation, security
- Ship itprojects on GitHub, Docker, cloud deploy, interviews
Maven: real project structure
Real projects use a build tool to compile code, download libraries and run tests. Maven (or Gradle) reads a pom.xml file that lists your dependencies:
my-app/
├── pom.xml # project + dependencies
└── src/
├── main/java/com/learnfrenzy/app/ # application code
└── test/java/com/learnfrenzy/app/ # tests
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.11.3</version>
<scope>test</scope>
</dependency>
</dependencies>
mvn compile # build
mvn test # run all tests
mvn package # create target/my-app.jar
Unit tests with JUnit 5
A unit test checks one small piece of code automatically. Teams run thousands of them on every change, so bugs are caught in minutes instead of in production. Testing the Library rules from the project:
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class LibraryTest {
private Library lib;
@BeforeEach
void setUp() {
lib = new Library();
lib.addBook("B1", "Clean Code", "Robert C. Martin", Genre.TECH);
lib.addMember(new Member("M1", "Asha"));
lib.addMember(new Member("M2", "Ben"));
}
@Test
void issuesAnAvailableBook() {
lib.issue("B1", "M1");
assertFalse(lib.allBooks().get(0).isAvailable());
}
@Test
void refusesToIssueTheSameBookTwice() {
lib.issue("B1", "M1");
LibraryException e = assertThrows(LibraryException.class, () -> lib.issue("B1", "M2"));
assertEquals("B1 is already issued to M1", e.getMessage());
}
}
Run with mvn test or the green ▶ icons in IntelliJ. Writing tests for your projects is one of the fastest ways to stand out as a fresher.
Databases: SQL and JDBC
Almost every application stores data in a relational database. Learn SQL first (SELECT, JOIN, GROUP BY, indexes), then connect from Java. Plain JDBC looks like this – note the PreparedStatement, which prevents SQL injection:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Main {
public static void main(String[] args) throws SQLException {
String url = "jdbc:mysql://localhost:3306/library";
try (Connection con = DriverManager.getConnection(url, "app_user", System.getenv("DB_PASSWORD"));
PreparedStatement ps = con.prepareStatement("SELECT id, title FROM books WHERE genre = ?")) {
ps.setString(1, "TECH");
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) System.out.println(rs.getString("id") + " " + rs.getString("title"));
}
}
}
}
In Spring Boot you'll mostly use Spring Data JPA, which generates this code for you – but interviewers expect you to understand what happens underneath.
Your first Spring Boot API
Spring Boot is the most in-demand Java framework for backend jobs. Create a project at start.spring.io (Java 21, dependency: Spring Web), open it in IntelliJ and add:
package com.learnfrenzy.library;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/books")
public class BookController {
record BookDto(String id, String title, String author) {}
private final List<BookDto> books = List.of(
new BookDto("B1", "Clean Code", "Robert C. Martin"),
new BookDto("B2", "Wings of Fire", "A. P. J. Abdul Kalam"));
@GetMapping
public List<BookDto> all() {
return books; // converted to JSON automatically
}
@GetMapping("/{id}")
public BookDto one(@PathVariable String id) {
return books.stream().filter(b -> b.id().equals(id)).findFirst()
.orElseThrow(() -> new IllegalArgumentException("No book " + id));
}
}
./mvnw spring-boot:run
curl http://localhost:8080/api/books/B1
{"id":"B1","title":"Clean Code","author":"Robert C. Martin"}Everything in this controller is something you learned in this course: a class, a record, a list, a stream, Optional, an exception and annotations. Spring adds the web server, JSON conversion and dependency injection around it.
A 12-week plan to job-ready
| Weeks | Focus | Output |
|---|---|---|
| 1–2 | Revise weak chapters; 2 coding problems a day (arrays, strings, maps) | 50 solved problems |
| 3–4 | Git, Maven, JUnit; SQL (joins, group by) | Library project on GitHub with tests |
| 5–8 | Spring Boot: REST, validation, Spring Data JPA, exception handling, basic security | A CRUD API with MySQL/PostgreSQL |
| 9–10 | DSA for interviews: sorting, binary search, hashing, two pointers, recursion | 100+ problems total |
| 11–12 | Mock interviews, output-based questions, project walkthroughs, resume | Ready for TCS/Infosys/Accenture and product-company rounds |
What interviewers check for Java freshers
OOP pillars with real examples; String immutability and the pool; equals/hashCode; ArrayList vs LinkedList; how HashMap works; checked vs unchecked exceptions; streams and lambdas; multithreading basics; and one project you can explain line by line. Every one of those is covered in this course.
Practise on LearnFrenzy
- Java Programming interview track – core Java, OOP, collections, concurrency, JVM, Spring Boot.
- Java coding interview programs and output-based tricky questions.
- Spring Boot interview questions.
- Placement Prep kits – company test patterns and timed mocks.
- Daily Code Challenge – one puzzle a day to keep sharp.
Final check
Quick check
What does Maven's pom.xml contain?
Project information and its dependencies (libraries), plugins and build settings.
Why use PreparedStatement instead of building SQL strings?
It separates data from the query, preventing SQL injection, and lets the database reuse the query plan.
Which annotation turns a class into a REST endpoint handler in Spring Boot?
@RestController (with mappings such as @GetMapping).
Summary
- Next: Maven/Gradle, JUnit 5, Git, SQL with JDBC, then Spring Boot and JPA.
- Build one complete project with tests and a REST API, and publish it on GitHub.
- Practise coding and interview questions every day – consistency beats cramming.
Thank you for learning Java with LearnFrenzy. Keep building – every program you write makes the next one easier.
Finished this lesson?
Mark it complete to track your progress. You have reached the end of this track — well done!