انتقل إلى المحتوى
أمين أبوزيد
JNR-011

Spring Boot

  • 8 درس
  • 2 ساعة تدريب (تقدير)
في هذه الصفحة 8 موضوعات

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

نظرة عامة

الموضوعات

  • Starters
  • الإعداد التلقائي (Auto-configuration)
  • هيكل المشروع
  • الخوادم المضمّنة

تعلّم أولًا

2 ساعة تدريب (تقدير)

مخرجات التعلم

  1. Explain starters and how auto-configuration decides what to create (conditions).
  2. Read the conditions evaluation report to see why something was or was not configured.
  3. Override an auto-configured bean.
  4. Describe the embedded server and build an executable JAR.

الدروس

  1. 01ما الذي يضيفه Boot إلى Spring
  2. 02Starters
  3. 03الإعداد التلقائي والشروط
  4. 04تجاوز القيم الافتراضية
  5. 05الخوادم المضمّنة وملفات JAR القابلة للتنفيذ
  6. 06أعراف هيكل المشروع
  7. 07عرض عملي: قراءة تقرير تقييم الشروط
  8. 08عرض عملي: تجاوز الإعداد التلقائي لـ Jackson

المختبر والتمارين

Lab

JNR-011-LAB1 · Under the hood

Outcomes: 1–4 · Time: ~2 h

  1. Run the Shop API with --debug and save the conditions evaluation report.
  2. Pick three auto-configurations that applied (positive matches) and one that did not (negative match); for each, write the condition that decided it.
  3. Override the default JSON date format (property first, then customizer).
  4. Build the executable JAR and run it with java -jar.

Acceptance: written explanation matches the report; date format changed; JAR runs.

Exercises (assessment: explain the startup sequence of the Shop API)

IDOutcomeTask
JNR-011-EX011Explain in three sentences what a starter and an auto-configuration are and how they differ.
JNR-011-EX021Name the three conditions @ConditionalOnClass, @ConditionalOnMissingBean, @ConditionalOnProperty and give one example of each.
JNR-011-EX032In the report, find why a DataSource was not created in a project without a database starter.
JNR-011-EX043Define your own Clock or ObjectMapper bean and confirm in the report that Boot's default backed off.
JNR-011-EX054Build the JAR, list its contents with jar tf, and find the embedded server library.
JNR-011-EX064Write the startup sequence of the Shop API: main, SpringApplication.run, context creation, scanning, auto-configuration, server start, "Started".
أظهر الحلول
  • EX01 A starter is a dependency bundle; auto-configuration is the code, triggered by what is on the classpath, that creates beans. Starter supplies the libraries; auto-configuration wires them.
  • EX02 Class present (Tomcat classes); missing bean (no user-defined ObjectMapper); property (spring.main.banner-mode, or a feature flag).
  • EX03 Negative match: required classes, or a bean of the needed type, are absent.
  • EX04 The report lists the default bean under negative matches with @ConditionalOnMissingBean found a bean.
  • EX05 jar tf target/*.jar shows BOOT-INF/lib/tomcat-embed-core-*.jar.
  • EX06 main calls run; Boot prepares the environment and creates the context; scanning finds your beans; auto-configuration adds the defaults; the embedded server starts; the app logs "Started".

الاختبار

Outcomes: O1 starters and auto-configuration · O2 conditions report · O3 overriding · O4 embedded server and JAR.

اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.

  1. 1A starter is:O1
  2. 2Auto-configuration decides what to create based on:O1
  3. 3@ConditionalOnMissingBean means:O1
  4. 4How do you turn on the conditions evaluation report?O2
  5. 5An auto-configuration appears under "Negative matches". It means:O2
  6. 6The preferred first way to change a Boot default:O3
  7. 7You define your own ObjectMapper bean. Boot's default:O3
  8. 8Blindly excluding auto-configurations is risky because:O3
  9. 9The embedded server is:O4
  10. 10To run the built executable JAR you need:O4

الجزء العملي

Six exercises JNR-011-EX01 to EX06 plus the lab. The assessment is EX06: explaining the Shop API startup sequence. Pass: quiz at least 8/10, the lab explanation matches the report, EX06 correct.

أخطاء شائعة

Treating auto-configuration as magic; excluding auto-configurations blindly.

التقييم

Explain the startup sequence of the Shop API.

الصلة بالمسار الوظيفي

Troubleshooting configuration issues in real services.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.