0
0
Spring Bootframework~10 mins

@Qualifier for ambiguous beans in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to inject a specific bean using @Qualifier.

Spring Boot
@Autowired
@Qualifier("paymentService")
private Service [1];
Drag options to blanks, or click blank then click option'
AService
Bservice
CpaymentService
Dbean
Attempts:
3 left
💡 Hint
Common Mistakes
Using the class name instead of the bean name.
Using a generic variable name that causes ambiguity.
2fill in blank
medium

Complete the annotation to specify which bean to inject.

Spring Boot
@Autowired
@Qualifier("[1]")
private Service service;
Drag options to blanks, or click blank then click option'
ApaymentService
Bservice
CService
Dbean
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the quotes around the bean name.
Using the class name instead of the bean name.
3fill in blank
hard

Fix the error in the injection by adding the correct annotation.

Spring Boot
@Autowired
[1]
private Service service;
Drag options to blanks, or click blank then click option'
ApaymentService
Bbean
Cservice
D@Qualifier("paymentService")
Attempts:
3 left
💡 Hint
Common Mistakes
Only renaming the variable without @Qualifier.
Using @Qualifier without specifying the bean name.
4fill in blank
hard

Fill both blanks to declare and inject the correct bean using @Qualifier.

Spring Boot
@Autowired
@Qualifier("[1]")
private [2] service;
Drag options to blanks, or click blank then click option'
ApaymentService
BOrderService
CUserService
Dservice
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing bean names and class types incorrectly.
Using a generic class type that does not match the bean.
5fill in blank
hard

Fill all three blanks to define two beans and inject one using @Qualifier.

Spring Boot
@Bean
public [1] [2]() {
    return new [1]();
}

@Autowired
@Qualifier("[2]")
private [1] service;
Drag options to blanks, or click blank then click option'
APaymentService
BpaymentService
COrderService
DorderService
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for bean and qualifier.
Mismatching class type and bean name.