إعداد المشروع والتبعيات
أعدّ مشروع 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 يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- مقدمة إلى Spring Security 6
- إعداد المشروع والتبعيات
- مصادقة المستخدمين داخل الذاكرة
- فهم سلسلة عوامل تصفية Spring Security