[jboss-user] [jBPM] - Re: Jbpm 5 - call to spring beans

malabalu do-not-reply at jboss.com
Tue Feb 21 13:12:11 EST 2012

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**


**private** **static** ApplicationContext +ac+;

**public** **static**
 ServiceInstance getInstance() {

**return** ++staticServiceInstance++


**public** **void**
 setApplicationContext(ApplicationContext applicationContext)

 BeansException {

**if** (++ac++ == *null*) {
 ac = applicationContext;}

*public*  Object getBean(String beanId) {

**return** +ac+.getBean(beanId);}

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120221/d1f1920a/attachment-0001.html 

More information about the jboss-user mailing list