Grokking Spring Boot
Vote

0% completed

​

Choosing Between Beans

The venue asks for a second kind of confirmation: some customers want a text message as well as an email. The team turns Notifier into an interface with two implementations, EmailNotifier and SmsNotifier, and annotates both with @Component. BookingService still asks for a Notifier in its constructor. The next start of the service fails.

Parameter 2 of constructor in com.example.booking.bookings.BookingService required a single bean, but 2 were found: - emailNotifier: defined in file [...EmailNotifier.class] - smsNotifier: defined in file [...SmsNotifier.class] Action:

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content