2v0-7222 Exam QuestionsBrowse all questions from this exam

2v0-7222 Exam - Question 61


Refer to the exhibit.

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

Show Answer
Correct Answer: A

The LegacySingleton class uses the Singleton Design Pattern to ensure that only one instance of the class is created. The way to achieve this in a Spring Bean is by calling the LegacySingleton.getInstance() method from within a @Bean method and returning the instance. This allows Spring to manage the singleton instance as a bean without modifying the original class.

Discussion

1 comment
Sign in to comment
saJAvaOption: A
Jun 11, 2024

correct