عرض عملي: ربط Shop Core يدويًا ثم باستخدام Spring
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
move Shop Core from manual new to Spring beans; prepares JNR-009-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Show
mainbuildingPricingService,PaymentProvider, andOrderServicewithnew. - Annotate the services with
@Serviceand keep constructor parameters. - Delete the
newcalls frommain; run the Boot app. - Planned mistake: put
@Autowiredon a field and write a unit test withnew OrderService(...); the field is null and the test fails. Fix: switch to constructor injection. - Show that the unit test now passes a fake
PaymentProvider.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.