دورة حياة الـ Bean والاستدعاءات
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
name the four lifecycle stages.
الموضوعات المخطط لها
- Stages: instantiation (constructor), injection of dependencies, initialization, destruction at shutdown.
@PostConstructruns after injection;@PreDestroyruns before the bean is removed.- Use callbacks for light setup and cleanup, not heavy work.
- Never use injected fields inside the constructor body of a field-injected bean: they are not set yet.
تفاصيل المخطط المبدئي
عرض عملي
a timeline: constructor → dependencies set → @PostConstruct → bean in use → @PreDestroy.
اختبر فهمك
Which runs first, @PostConstruct or injection?
أظهر الإجابة
Injection.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.