malabalu [https://community.jboss.org/people/malabalu] created the discussion

"Re: Jbpm 5 - call to spring beans"

To view the discussion, visit: https://community.jboss.org/message/718452#718452

--------------------------------------------------------------
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/ 
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 
oforg.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);}
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/718452#718452]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to