cancel
Showing results for 
Search instead for 
Did you mean: 

custom spring context loder

activitinike
Champ in-the-making
Champ in-the-making
Hello,

Please guide on setting custom spring context in activiti-app.war.

In SericeTask javaDelegate, we have many dependencies to inject (RestTemplate, some DAO etc..)


<context-param> 
        <param-name>contextConfigLocation</param-name> 
        <param-value>/WEB-INF/classes/applicationContext.xml</param-value> 
    </context-param> 

   <listener> 
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener>


I tried to add spring context loader, but autowiring always return null onject.

Thanks for any help.
13 REPLIES 13

jonnyg
Confirmed Champ
Confirmed Champ
Thanks, that makes sense.
(Curious – what is it that kicks off the default component scan, telling it to look in com.activiti.extension.conf? e.g., is ActivitiEngineConfiguration special in any way?)

jbarrez
Star Contributor
Star Contributor
No, nothing special about it, it could go into any configuration class actually, it wouldn't make a difference.

activitinike
Champ in-the-making
Champ in-the-making
Thanks,  now service task using spring bean works with custom package.

I tried to do the same with ServiceTask java which implements JavaDelegate, but it doesn't work. Is there a way?

jbarrez
Star Contributor
Star Contributor
Did you add @Component to the javadelegate and gave it a name you reference in the process definition?