0Pricing
Spring Security 6 & JWT Authentication · Lesson

Project Setup and Dependencies

Set up a new Spring Boot project and integrate the necessary Spring Security dependencies for a secure environment.

Project Setup and Dependencies is a free Spring Security 6 & JWT Authentication lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Spring Security 6 & JWT Authentication learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Ready for Secure Apps!

Let's get a real project ready. You'll spin up a Spring Boot app and pull in the dependencies that switch on Spring Security 6.

Creating a Spring Boot Project

Start fast with Spring Initializr at start.spring.io — a web wizard that generates your whole project structure and build files in seconds.

Initializr Basics

In Spring Initializr you pick the build (Maven), language (Java), a stable Boot version, and metadata like group and artifact. That defines your project skeleton.

What Are Dependencies?

Dependencies are external libraries your app pulls in for features it doesn't write itself — pre-built code you wire in instead of reinventing.

The Security Starter

One dependency unlocks it all: spring-boot-starter-security. This starter pulls in the core auth and authorization modules in a single line.

Web Application Needs

To serve HTTP, add spring-boot-starter-web. It bundles embedded Tomcat and Spring MVC so your app can handle web requests and API responses.

Maven: Your Project's Blueprint

With Maven, you declare every library in pom.xml — your project's blueprint inside a <dependencies> block that tells Maven what to fetch.

Adding Security to pom.xml

Here's how the two starters sit inside your pom.xml dependencies block. Initializr adds these automatically when you select them.

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <!-- Other dependencies like spring-boot-starter-test... -->
</dependencies>

First Run: What Happens?

Run the app with the security starter added and Spring Security locks every endpoint instantly. Watch the console for its generated default password.

package com.coddykit.securitysetup;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SecuritysetupApplication {

  public static void main(String[] args) {
    SpringApplication.run(SecuritysetupApplication.class, args);
    System.out.println("\n--- Application Started --- ");
    System.out.println("Check your console for a default password if you access the app.");
  }

}

Quick Check!

After adding spring-boot-starter-security to a new Spring Boot web project, what is the immediate default behavior when you try to access any endpoint in your browser?

Recap: Project Ready!

Recap: you scaffolded a project with Spring Initializr, added the web and security starters, and saw Boot hand you a login page and console password for free.

Frequently asked questions

Is the “Project Setup and Dependencies” lesson free?

Yes — the full text of “Project Setup and Dependencies” is free to read here on the web, and the Spring Security 6 & JWT Authentication course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Spring Security 6 & JWT Authentication course, upgrade to CoddyKit PRO.

What will I learn in “Project Setup and Dependencies”?

Set up a new Spring Boot project and integrate the necessary Spring Security dependencies for a secure environment. You practise Spring Security 6 & JWT Authentication with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Spring Security 6 & JWT Authentication?

No prior experience is required. Spring Security 6 & JWT Authentication on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Project Setup and Dependencies” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Spring Security 6 & JWT Authentication lesson?

Yes. Every Spring Security 6 & JWT Authentication lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Introduction to Spring Security 6
  2. Project Setup and Dependencies
  3. In-Memory User Authentication
  4. Understanding the Spring Security Filter Chain
← Back to Spring Security 6 & JWT Authentication