New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

VMware 2V0-72.22 Exam - Topic 11 Question 67 Discussion

Actual exam question for VMware's 2V0-72.22 exam
Question #: 67
Topic #: 11
[All 2V0-72.22 Questions]

Refer to the exhibit.

How can a Spring Bean be created from this LegacySingleton class?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Matilda
3 months ago
Wait, is it really not possible without changing the constructor? That sounds odd!
upvoted 0 times
...
Merilyn
3 months ago
D seems like overkill, why modify the class?
upvoted 0 times
...
Jamal
3 months ago
C makes sense, can't create a bean with a private constructor.
upvoted 0 times
...
Zana
4 months ago
I think B could work too, but it's not ideal.
upvoted 0 times
...
Margery
4 months ago
A is definitely the way to go!
upvoted 0 times
...
Kandis
4 months ago
I feel like modifying the LegacySingleton class is a bit too much for this question, so I would lean towards option A as well.
upvoted 0 times
...
Lynda
4 months ago
I practiced a similar question where we had to create a bean from a singleton class, and I think we called a method to get the instance, like in option A.
upvoted 0 times
...
Dell
4 months ago
I'm not entirely sure, but I remember something about needing a public constructor for Spring to create beans. Maybe option C is correct?
upvoted 0 times
...
Brandon
5 months ago
I think option A makes the most sense since we can use the singleton pattern to get the instance.
upvoted 0 times
...
Hollis
5 months ago
I think the answer is to call the LegacySingleton.getInstance() method from within a @Bean method. That way, I can return the existing singleton instance to the Spring context.
upvoted 0 times
...
Leonor
5 months ago
I'm a bit confused on this one. The question mentions modifying the LegacySingleton class, but I'm not sure if that's the best approach. I'll need to review the Spring Bean lifecycle and how to handle existing singletons.
upvoted 0 times
...
Carman
5 months ago
Okay, let's see. The key here is that the LegacySingleton class is a singleton, so I'll need to find a way to leverage that in the Spring context.
upvoted 0 times
...
Keneth
5 months ago
Hmm, this looks like a tricky one. I'll need to think carefully about the Spring Bean creation process and how it interacts with the LegacySingleton class.
upvoted 0 times
...
Mitsue
12 months ago
Hold up, did anyone else notice the exhibit is just a picture of a dog? I'm so distracted now, I forgot the question. What were we talking about again?
upvoted 0 times
Filiberto
11 months ago
D) Modify the LegacySingleton class by adding the @Autowired annotation to the instance variable.
upvoted 0 times
...
Genevieve
11 months ago
C) It is not possible without modifying the LegacySingleton class, the constructor must be public.
upvoted 0 times
...
Wilda
11 months ago
B) Return an instance of LegacySingleton using the new keyword from a @Bean method.
upvoted 0 times
...
Anthony
11 months ago
A) Call LegacySingleton.getInstance() from within a @Bean method and return the instance.
upvoted 0 times
...
...
Becky
12 months ago
You know, if this was a real-world problem, I'd just rewrite the whole darn thing from scratch. Screw legacy code! Option D is my pick.
upvoted 0 times
...
Joana
12 months ago
C'mon, really? We can't modify the class? That's just lazy. Option B all the way!
upvoted 0 times
Selma
11 months ago
You're right, we can't modify the class. The correct answer is A) Call LegacySingleton.getInstance() from within a @Bean method and return the instance.
upvoted 0 times
...
Margurite
11 months ago
Option B is not the correct way to create a Spring Bean from this LegacySingleton class.
upvoted 0 times
...
...
Myrtie
12 months ago
I think option A is the way to go. Calling getInstance() from a @Bean method seems like the cleanest approach.
upvoted 0 times
Helene
11 months ago
User2: Yes, calling getInstance() from a @Bean method is the cleanest way to create a Spring Bean from LegacySingleton.
upvoted 0 times
...
Annita
12 months ago
User1: I agree, option A is the most appropriate solution here.
upvoted 0 times
...
...
Skye
1 year ago
But wouldn't adding the @Autowired annotation to the instance variable also work? That's option D.
upvoted 0 times
...
Annamaria
1 year ago
I disagree, I believe the answer is C. We need to modify the LegacySingleton class to make the constructor public.
upvoted 0 times
...
Skye
1 year ago
I think the answer is A, because we can call LegacySingleton.getInstance() from a @Bean method.
upvoted 0 times
...

Save Cancel