-
1. Re: jbpm 4.3 spring & DecisionHandler question
saraswati.santanu Jan 30, 2010 10:40 AM (in response to ammallex)Unforunately there is no clean way of doing this. You can however use some workaround.
If you remember that good old ServiceLocator J2EE pattern, you can code something similar to locate your spring beans. You can have a class like this:
import javax.annotation.Resource;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;/**
* @author Santanu
*
*/
@Component("serviceLocator")
public class ServiceLocator {
private static ApplicationContext applicationContext;
@Resource
public void setAplicationContext(ApplicationContext applicationContext) {
ServiceLocator.applicationContext = applicationContext;
}
public static Object getService(String beanName) {
return applicationContext.getBean(beanName);
}
}Now in your decision handler can make use of this like this
public class YourDecisionHandler implements DecisionHandler {
private YourSpringBean bean = ServiceLocator.getService("yourBeanName");
public String decide(OpenExecution execution) {
//make use of your bean here
}
} -
2. Re: jbpm 4.3 spring & DecisionHandler question
ammallex Jan 30, 2010 10:54 AM (in response to saraswati.santanu)thx for answer! i know about this workaround, but i suppose it isn't so good decision as can be.
it is strange that jbpm don't provide more better way.