Announcement Announcement Module
Collapse
No announcement yet.
Obtain Spring bean reference without DI Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Obtain Spring bean reference without DI

    I have a class that can not be configured as a spring bean that need to have a reference to a spring bean instance.

    How do I obtain that spring bean singleton instance? I am not sure how to use ContextSingletonBeanFactoryLocator or ApplicationContext or any other ways to accomplish this

    Thank you in advance.

  • #2
    you have to use the @Configurable annotation on the class which was not created by spring and you can inject dependency with the annotation @Autowired

    Comment


    • #3
      Due to the nature of how my class is instantiated, those annotations did seem to configure or inject dependency at all.

      How would I be able to get a reference to the bean using ContextSingletonBeanFactoryLocator ??

      Thanks

      Comment

      Working...
      X