0Pricing
Spring Security 6 & JWT Authentication · Урок

Настройка проекта и зависимости

Настройте новый проект Spring Boot и подключите необходимые зависимости Spring Security для создания защищённой среды.

«Настройка проекта и зависимости» — бесплатный урок Spring Security 6 & JWT Authentication на CoddyKit. Это урок 2 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения Spring Security 6 & JWT Authentication, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс Spring Security 6 & JWT Authentication содержит 4 уроков всего.

Части этого урока еще не переведены и отображаются на английском.

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.

Часто задаваемые вопросы

Урок «Настройка проекта и зависимости» бесплатный?

Да — полный текст урока «Настройка проекта и зависимости» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс Spring Security 6 & JWT Authentication, подпишись на CoddyKit PRO. Курс Spring Security 6 & JWT Authentication содержит 4 уроков всего.

Чему я научусь в уроке «Настройка проекта и зависимости»?

Настройте новый проект Spring Boot и подключите необходимые зависимости Spring Security для создания защищённой среды. Ты практикуешь Spring Security 6 & JWT Authentication с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать Spring Security 6 & JWT Authentication?

Предыдущий опыт не требуется. Spring Security 6 & JWT Authentication на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 2 из 4.

Сколько времени занимает урок «Настройка проекта и зависимости»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке Spring Security 6 & JWT Authentication?

Да. Каждый урок Spring Security 6 & JWT Authentication включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Введение в Spring Security 6
  2. Настройка проекта и зависимости
  3. Аутентификация пользователей в памяти
  4. Понимание цепочки фильтров Spring Security
← Назад к Spring Security 6 & JWT Authentication