-
1. Re: @Inject in @WebServiceClient does not work
sfcoy Oct 14, 2013 9:06 AM (in response to lafr)The javadoc for @javax.xml.ws.WebServiceClient opens with:
Used to annotate a generated service interface
So, I don't think this class is going to behave in the way that you want anyway...
-
2. Re: @Inject in @WebServiceClient does not work
lafr Oct 14, 2013 10:52 AM (in response to sfcoy)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.
-
3. Re: @Inject in @WebServiceClient does not work
sfcoy Oct 15, 2013 8:56 AM (in response to lafr)1 of 1 people found this helpfulHow 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.
-
4. Re: @Inject in @WebServiceClient does not work
lafr Oct 15, 2013 9:52 AM (in response to sfcoy)ItemsService is used as a "normal" instance variable in other class, instance created with new:
@Named
@ConversationScoped
public class Kanban
{
private ItemsService itemsService;
@PostConstruct
void init()
{
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.
-
5. Re: @Inject in @WebServiceClient does not work
sfcoy Oct 15, 2013 10:23 AM (in response to lafr)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.