Exam 2v0-7222 All QuestionsBrowse all questions from this exam
Question 61

Refer to the exhibit.

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

    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
saJAvaOption: A

correct