How to get spring context inside a portlet (processAction, doView, ...) ?

XMLWordPrintable

    • Type: Bug
    • Resolution: Support Request
    • Priority: Low
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:

      Windows XP sp2
      JDK 1.4
      Tomcat / Eclipse

      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      Is it possible to access spring context inside the portlet code ?
      I'm trying to use spring-portlet.jar.
      Here is what I want to do :

      public class HelloWorld extends GenericPortlet {
      public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
      Object myFooObject = getApplicationContext().getBean("myFooObjectName");
      ...

      I tried to initialize a singleton on startup which provides static access to the context. I tried to access it from the portlet, but it seems that in this case it's not a valid portlet anymore.

      My goal is to provide an access to database objects like BO, DAO and services (through hibernate/spring-hibernate) .

      Is it possible to do this differently ?
      Many thanks,
      Rom

            Assignee:
            Unassigned
            Reporter:
            Romain Baratta
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: