Announcement Announcement Module
No announcement yet.
Integrating Spring-Webflow and Spring-DM Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Integrating Spring-Webflow and Spring-DM

    Hi All,
    I was trying to use Spring Webflow in OSGi environment powered by Spring-DM.

    While Spring DM creates OSGi application context from the xml files under /META-INF/spring folder inside a bundle, this is totally different from Application Context that the Spring Webflow creates.

    I was wondering how I can use beans defined in the xmls for Spring-DM to be used in the flow definitions? Can the beans in the two contexts communicate/ be shared? Can't it be just one application context instead of two?

    I was looking around to find answers to this, but unfortunately i could not

    Has anyone tried this and get this to work? Has any effort been made by Spring Webflow towards this direction?
    Last edited by Thomas Joseph; Oct 7th, 2008, 12:35 AM.

  • #2
    Spring webflow doesn't create an ApplicationContext (not counting the BeanFactory for the FlowDefinitions). Also Spring Web Flow should be perfectly able to run in an OSGi/Spring DM fashion, the jars are valid OSGi bundles.

    So I would say it is a setup issue on your side, however without the whole structure and configuration it is hard to see where the issue lies.


    • #3
      Hi Marten,
      Thanks for the quick reply.

      In my setup, I pass the context configuration file (via webflows dispatcher servlet), but this is different from the file that Spring-DM uses to create OSGi application context. If I would refer to any OSGi service from this configuration file (context configuration file) and try to use it in webflow definitions, it will work perfect. But this is not what I want.

      Rather, I have different set of files inside /META-INF/spring that the Spring-DM uses to create context. I want bean definitions from here to be used when defining flows.

      Hope you have got my problem.


      • #4
        Adding further...,

        I have the /META-INF/spring files residing in bundles other than where i have the webflow configurations.

        .. infact the bundles contribute to the bean definitions that the webflow needs to pick up


        • #5
          Hi All,
          I understand that Spring's OSGi effort, especially in the web side are where we have a monolithic war that is osgified running in an OSGi space. Of course with OSGi we can avoid having to embed libraries inside wars, but still all the configurations etc, would go plainly inside the monolithic war.

          AFAI understand, there is hardly any notion of 'web-modules' in SpringSource projects, where the modules would add up functionality to existing application - even on the web side. This would be the ideal case where we fully leverage the OSGi power.

          On the other side, I am working on a web application with the notion of 'web-modules'. We have already succeeded in integrating JSF (Myfaces), Facelets, Spring Core, Spring-dm, on the web side. Spring webflow is also partly integrated, but are facing problems, that I addressed before in this thread.

          I was really hoping that with this forum, I could get some cool helps and hints towards my effort. But now I feel that I have to live with it (doing hacks), or look at some other workflow solutions.

          Will SpringSource ever do an effort on 'web-modules' concept? I will be eager to know that!

          NB: Please excuse me for using 'web-modules' too much, for which there is no formal definition.
          Thomas Joseph


          • #6
            Got the same integration problem

            Hello, everyone!

            I have the same problem and do not even see any acceptable solution. It doesn't look like a configuration issue. I tried to investigate this in debugger and saw that the contexts was even presented by different classes although, of course, this fact itself doesn't prove the existing of the bug. I don't understand all the internals of Spring context implementations but webflow context is using differrent resource loader that is seemingly agnostic of Spring-dm Powered resources.

            Could anyone please help to solve this problem or at least give some explanations on this?
            Thanks in advance.


            • #7
              Some additions to the previous post.

              I should have expressed my thoughts more clear in the previous post.
              The point is that I try to access web application context from JSP custom tag implementation. My tag extends Spring RequestContextAwareTag class that is supposed to be aware of web application context. In doStartTagInternal() method i am getting web app context calling getRequestContext().getWebApplicationContext().

              If i'm using usual Spirng MVC controller to handle request then this application context object contains all my custom tag needs to be able to do its work (beans from Spring-dm powered context). But if the same view is rendered via web flow controller then getRequestContext().getWebApplicationContext() gives the context object that cannot provide the desired beans calling context.getBeansOfType(someTypeOfBeans)

              What is wrong here? Is this approach correct?