cancel
Showing results for 
Search instead for 
Did you mean: 

JavaDelegate / @Scope(SCOPE_PROTOTYPE) doesn't work :(

pbreak75
Champ in-the-making
Champ in-the-making
I'm using activiti-explorer project, I added @Scope(SCOPE_PROTOTYPE) annotation in my JavaDelegate class but there no effect !   did i miss something ? should i add some configuration in my activiti-custom-context.xml file ?


Regard,

1 ACCEPTED ANSWER

warper
Star Contributor
Star Contributor
Your JavaDelegate is not defined in spring context, and your spring context doesn't use component scan. I don't think your java delegate is spring bean. Probably it's called by class name. For this case Activiti User Guide explains what you see:
8.5.3. Java Service Task

Implementation

Note: there will be only one instance of that Java class created for the serviceTask it is defined on. All process-instances share the same class instance that will be used to call execute(DelegateExecution). This means that the class must not use any member variables and must be thread-safe, since it can be executed simultaneously from different threads. This also influences the way Field injection is handled.

View answer in original post

1 REPLY 1

warper
Star Contributor
Star Contributor
Your JavaDelegate is not defined in spring context, and your spring context doesn't use component scan. I don't think your java delegate is spring bean. Probably it's called by class name. For this case Activiti User Guide explains what you see:
8.5.3. Java Service Task

Implementation

Note: there will be only one instance of that Java class created for the serviceTask it is defined on. All process-instances share the same class instance that will be used to call execute(DelegateExecution). This means that the class must not use any member variables and must be thread-safe, since it can be executed simultaneously from different threads. This also influences the way Field injection is handled.