The class itself is working fine, for generations of JBoss AS's (4.24, 7.2, 8.0).
New now only the try to use DI here.
1 of 1 people found this helpful
How do instances of ItemsService come into being?
For there to be any chance of injection the container would need to be in control of the instance lifecycle. Other JAX-WS elements such as the service implementation and handlers support the common annotations style of injection (aka @Resource), but web service clients don't rate a mention because it's expected that they are generated code.
ItemsService is used as a "normal" instance variable in other class, instance created with new:
public class Kanban
private ItemsService itemsService;
this.itemsService = new ItemsService();
So in short the answer is, that Injection is not possible for WebServiceClient's and I have to implement other solution?
Thanks for your support.
Injection never works for objects that are created using "new" without additional processing.
For your purpose, however, I can see no reason why ItemsService cannot just be @Injected into Kanban. If it has a default constructor it should just work.
It's worth catching up on CDI 1.1 if you haven't already.