Broadcom-VMware
2V0-72.22 · Question #71
Refer to the exhibit. How can a Spring Bean be created from this LegacySingleton class?
The correct answer is A. Call LegacySingleton.getInstance() from within a @Bean method and return the instance. See the full explanation below for the reasoning.
Question
Refer to the exhibit. How can a Spring Bean be created from this LegacySingleton class?
Exhibit
Options
- ACall LegacySingleton.getInstance() from within a @Bean method and return the instance.
- BReturn an instance of LegacySingleton using the new keyword from a @Bean method.
- CIt is not possible without modifying the LegacySingleton class, the constructor must be public.
- DModify the LegacySingleton class by adding the @Autowired annotation to the instance variable.
How the community answered
(26 responses)- A73% (19)
- B4% (1)
- C15% (4)
- D8% (2)
Community Discussion
No community discussion yet for this question.
