Announcement Announcement Module
Collapse
No announcement yet.
Integrating Spring IoC with Portlets and Tags Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Integrating Spring IoC with Portlets and Tags

    I didn't see any discussions on this topic in this forum or in the Core Container forum, so apologies in advance if I am covering old ground.

    Is there a way to integrate Portlets and Tags with Spring IoC? I'm not talking about using Spring MVC; I'm talking about writing a Tag class or a Portlet class that has dependencies on Spring-managed Beans.

    Currently, I have a Singleton called SpringHelper that implements the BeanFactoryAware interface. I use this Singleton to access Spring Beans from non-Spring classes. Is this my only option?

    Thanks,

    Jon

  • #2
    Replying to myself...

    I ended up building my own solution. I now have abstract SpringServlet, SpringPortlet, and SpringTag classes. Changing your Servlet, Portlet, or Tag to extend these classes will enable Spring to manage your dependencies.

    Any class can have its dependencies managed by Spring by implementing an interface (ExternalSpringBean) and calling SpringHelper.getInstance().applyDependencies(this) in the class' constructor or init method.

    None of this was difficult to implement, once I knew what to look for. I'm surprised it isn't present, out of the box, as it allows better Spring integration with an existing project.

    If anyone else is interested in these classes, let me know and I'll release them.

    Comment


    • #3
      Yes, could you post it. I was actually looking for the same thing.

      Comment


      • #4
        Take a look at this thread. I go into details on how I did it.
        Last edited by robyn; May 19th, 2006, 06:42 AM.

        Comment

        Working...
        X