Autowiring fileds in a ServiceTask ( ... a class implementing JavaDelegate)

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 08:27 AM
Hi
We are introducing some Activiti flow's into a well established Spring 4.11 project.
A place where we are stumbling is autowiring of existing spring artificacts into java service tasks
We've a handful of java classes implementing JavaDelegate. When we @Autowire a (hibernate dao) for example
(or a mybatis mapper) its null.
We are using spring ( ie context:component-scan ) to scan for various packages looking for @Component.
Everything in the application is being Autowired without issue, except for Activity related objects.
Yes, we have managed to get Spring to inject a bean into our service tasks using spring xml config( as demoed in the "chapter 9" demos of your book), but any further autowired fields that object itself my contain ( and any they may contain..and so on)
are not injected… so we get random nullpointers on various autowired fields.
Are we expected to plumb together all the autowired fields in the applciation context xml?
The documentation is really light here (afaics)…. even the demos in Chapter 9 of the book…
Could you point me to a demonstration app, somewhere that is (persisting a hibernate dao for example?)
A substantial demonstration of Activiti with spring annotations?
Thanks in advance
We are introducing some Activiti flow's into a well established Spring 4.11 project.
A place where we are stumbling is autowiring of existing spring artificacts into java service tasks
We've a handful of java classes implementing JavaDelegate. When we @Autowire a (hibernate dao) for example
(or a mybatis mapper) its null.
We are using spring ( ie context:component-scan ) to scan for various packages looking for @Component.
Everything in the application is being Autowired without issue, except for Activity related objects.
Yes, we have managed to get Spring to inject a bean into our service tasks using spring xml config( as demoed in the "chapter 9" demos of your book), but any further autowired fields that object itself my contain ( and any they may contain..and so on)
are not injected… so we get random nullpointers on various autowired fields.
Are we expected to plumb together all the autowired fields in the applciation context xml?
The documentation is really light here (afaics)…. even the demos in Chapter 9 of the book…
Could you point me to a demonstration app, somewhere that is (persisting a hibernate dao for example?)
A substantial demonstration of Activiti with spring annotations?
Thanks in advance
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2015 07:02 AM
OK, first of all, i am assuming you are using activiti as a dependency in your Spring project,
How are you calling these service task Java delegates? Using an expression like ${mySpringBean.myMethod} ? Because the activiti:class won't work, it will do as advertised and create a instance of the class when needed.
>The documentation is really light here (afaics).
Cause there is not much to it, except using expressions. Which is in the docs.
How are you calling these service task Java delegates? Using an expression like ${mySpringBean.myMethod} ? Because the activiti:class won't work, it will do as advertised and create a instance of the class when needed.
>The documentation is really light here (afaics).
Cause there is not much to it, except using expressions. Which is in the docs.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2015 04:23 AM
Hello Joram,
thank you for responding, yes activiti is a dependency and we are using expressions like ${mySpringBean.myMethod}. I'm not exactly sure what is happening, but I'll guess it is a spring configuration issue.
Our junits do wire activiti service task objects, but if the injected objects themselves need autowiring.. those autowired fields are always null.
Since posting the above I've learnt that all gets wired up correctly at deploy time (using a different context).
As I said not sure whats going on but have a workaround for the junits…
thanks again
john
thank you for responding, yes activiti is a dependency and we are using expressions like ${mySpringBean.myMethod}. I'm not exactly sure what is happening, but I'll guess it is a spring configuration issue.
Our junits do wire activiti service task objects, but if the injected objects themselves need autowiring.. those autowired fields are always null.
Since posting the above I've learnt that all gets wired up correctly at deploy time (using a different context).
As I said not sure whats going on but have a workaround for the junits…
thanks again
john
