exam questions

Exam 2V0-72.22 All Questions

View all questions & answers for the 2V0-72.22 exam

Exam 2V0-72.22 topic 1 question 9 discussion

Actual exam question from VMware's 2V0-72.22
Question #: 9
Topic #: 1
[All 2V0-72.22 Questions]

Which two statements are true concerning constructor injection? (Choose two.)

  • A. If there is only one constructor the @Autowired annotation is not required.
  • B. Constructor injection only allows one value to be injected.
  • C. Constructor injection is preferred over field injection to support unit testing.
  • D. Construction injection can be used with multiple constructors without @Autowired annotation.
  • E. Field injection is preferred over constructor injection from a unit testing standpoint.
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Ancient1
Highly Voted 5 months, 3 weeks ago
Selected Answer: AC
A: @Autowired is not necessary if you have one constructor that instantiates the fields C: Constructor injection is preferred over field injection, as it helps with unit testing. Most IDE's will warn you against field injection anyways.
upvoted 5 times
...
antpao86
Most Recent 3 months, 4 weeks ago
Field injection is ambiguous and doesn't really tell you which dependencies are mandatory.
upvoted 1 times
...
Eymet
4 months ago
Selected Answer: AC
See other comments why
upvoted 2 times
...
zakupower
11 months ago
Selected Answer: AC
Contructor injection is preferred because it allows for easier unit testing. If only one constructor is available it will be used to inject dependencies without the need of @Autowired annotation.
upvoted 4 times
...
faciorys
1 year, 1 month ago
As of Spring Framework 4.3, an @Autowired annotation on such a constructor is no longer necessary if the target bean only defines one constructor to begin with. Answer A and C
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago