Skip to content
Ameen Abozaid
Planned lessonJNR-009-L08

Demo: diagnosing an ambiguous-bean startup failure

  • Lesson 8 of 8
  • Junior
On This Lesson 3 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

read the failure message and fix it three ways; prepares the assessment.

Draft outline details

Step by step

  1. Add a second PaymentProvider implementation and start the app.
  2. Read the report: it says expected single matching bean but found 2 and lists both names.
  3. Planned mistake: "fix" it by deleting one implementation. Explain why that removes a needed feature.
  4. Fix 1: @Primary on the default. Fix 2: @Qualifier("paypal") at the injection point.
  5. Fix 3: inject Map<String, PaymentProvider> and choose by key at run time.
  6. Run again and confirm the app starts.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Type to search levels, phases, modules and lessons.