Refer to the exhibit.
How can a Spring Bean be created from this LegacySingleton class?
Call LegacySingleton.getInstance() from within a @Bean method and return the instance.
Return an instance of LegacySingleton using the new keyword from a @Bean method.
It is not possible without modifying the LegacySingleton class, the constructor must be public.
Modify the LegacySingleton class by adding the @Autowired annotation to the instance variable.
Submit