الـ ApplicationContext
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
explain what the container is and holds.
الموضوعات المخطط لها
- The
ApplicationContextis the Spring container: it creates, wires, and keeps beans. - A bean is just an object the container manages.
- Startup: find bean definitions, create beans in dependency order, then the app is ready.
- You rarely touch the context directly; you ask for dependencies in constructors.
تفاصيل المخطط المبدئي
عرض عملي
ConfigurableApplicationContext ctx = SpringApplication.run(ShopApiApplication.class, args);
ProductService s = ctx.getBean(ProductService.class); // for the demo onlyاختبر فهمك
Should services call getBean themselves?
أظهر الإجابة
No. Declare the dependency in the constructor.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.