عرض عملي: اكتشاف خطأ الاستدعاء الذاتي (Self-invocation)
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
diagnose a transaction that never starts; prepares JNR-031-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Run the money-transfer exercise: a failure after debit leaves money missing.
- Check the code:
transfer()callsthis.debitAndCredit(), which has the annotation. - Prove it with the transaction log (
logging.level.org.springframework.transaction=TRACE): no transaction begins. - Planned mistake: mark the private method
@Transactionaland show it still does nothing. - Fix it by moving the method to another bean (or annotating the public entry point); re-run the failure test.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.