# 2V0-7222 — Question 603

**Type:** multiple_response
**Topics:** topic_1

## Question

Given an ApplicationContext containing three bean definitions of type Foo with bean ids foo1, foo2, and foo3, which three @Autowired scenarios are valid and will allow the ApplicationContext to initialize successfully? (Choose three.)

## Correct Answer

_See scenario._

## Explanation

A and D is not correct at all. I defined 3 beans definitions with those ids and in my service class used setter injection or simple Foo foo definition of Autowired-> gives error:

Could not autowire. There is more than one bean of 'Foo' type.
Beans:
foo1   (MyConfiguration.java), foo2   (MyConfiguration.java), foo3   (MyConfiguration.java) 

Working cases per single case: B,C,E,F
But not works all 4 together, C and F say the setFoo method name is already defined.


So B, E, F will work -> but will inject only 2 beans, foo3 and foo2 -> foo2 in 2 places, but is at the end the same bean defined once through setter injection and second time through autowired filed injection.

Or B, E, C will work -> will inject foo1, foo2, foo3

So the only correct answer to inject beans foo1,foo2,foo3 with working program is B, E, C.

**Reference:** examtopics_top_comment

---
Source: https://hiexam.net/q/vmware/2V0-7222/603  
Practice (tracked): https://hiexam.net/study/2V0-7222/practice