5 Replies Latest reply on Feb 21, 2012 4:08 PM by malabalu

    Jbpm 5 - call to spring beans

    malabalu

      can we make a call to spring beans from inside the activities /nodes in jbpm5.2? I have read soem examples for jbpm 4.

        • 1. Re: Jbpm 5 - call to spring beans
          malabalu

          We need to make a call to Spring Beans from the jbpm process .

          Is there anyway we can configure this without having a class to lookup the beans in spring context?

          • 2. Re: Jbpm 5 - call to spring beans
            eaa

            AFAIK, there is no native integration bewteen jbpm5 and spring beans. I wouldn't be that hard to create your own generic WIHandler to do this though.

             

            Best Regards,

            • 3. Re: Jbpm 5 - call to spring beans
              malabalu

              Thanks Esteban for your reply. As I originally mentioned in my post, I have read that in jbpm4, it is possible to call the spring beans from the process.

               

              http://www.inze.be/andries/2009/06/28/documentation-spring-jbpm-integration/

               

              Please look under configuration.I am new to jbpm and did not understand the whole configuration in the above one . May be it is something that was possible in jbpm4 but not in jbpm5.

               

               

              Also currently in our jbpm3 project, we are using a singleton class to look up beans in Spring context .I have pasted some of the code snippets .Since this has the hard coding of  the bean names in the codebase, we want to see if there are other ways.

               

               

               

              ServiceInstance serviceInstance = ServiceInstance.getInstance();

               

              return (PaymentService) serviceInstance.getBean("paymentServiceBean");

               

              where ServiceInstance is a class that implements implements org.springframework.context.ApplicationContextAware and has a property of

              org.springframework.context.ApplicationContext ...so the getBean will lookup the beans with name and return them.

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

               

              public class ServiceInstance implements

               

              ApplicationContextAware {

               

              private static ServiceInstance staticServiceInstance = new

              ServiceInstance();

               

              private static ApplicationContext ac;

               

               

              public static

              ServiceInstance getInstance() {

               

              return staticServiceInstance

              ;

              }

               

               

               

               

              @Override

               

               

              public void

              setApplicationContext(ApplicationContext applicationContext)

               

              throws

              BeansException {

               

              if (ac == null) {

               

              ac

              ac = applicationContext;

              }

              }

               

               

               

               

               

              public Object getBean(String beanId) {

               

              return ac.getBean(beanId);

              }

              • 4. Re: Jbpm 5 - call to spring beans
                eaa

                jbpm5 comes from a different code-base than jbpm3 and jbpm4. That is why some of the characteristics found there are not (yet) present in version 5. I would recommend you to read the documentation available about Task Nodes in BPMN2 and the concept of WorkItem and WorkItemHandler in jbpm5.

                 

                Best Regards,

                1 of 1 people found this helpful
                • 5. Re: Jbpm 5 - call to spring beans
                  malabalu

                  Thanks agian Esteban.I iwll read those.