Hi Ales,
Thanks for reply, I ll try to elaborate bit more. Simple example of what I am trying to do (besides figuring out how it all works together) is this:
I am trying to create custom subsystem with deployment processor that will pick up any ear or war deployed, if that deployment contains say class A with let say my own annotation @SomeServiceContext on attribute SomeService someService, it will create instance of class SomeService for that deployment. Idea then is when this class A is instantiated I want the attribute someService to be initialized with SomeService class created for this deploymen.
More less this might be viewed as very simple implementation of my own injection, reason is purely learning, I am aware that Weld does all this for us already. This is more along the lines - figure out how weld does it in the wildfly.
From the examples that I have followed, I am able to create subsystem, and detect if deployment contains my annotation. What I was trying to ask is what would be the best way to proceed from here, few options that came to my mind are:
1. Service in my subsystem might bind SomeService for this deployment into jndi, and I could use weld extensions to process classes with my @SomeServiceContext annotation to inject correct value of SomeService prepared for that deployment during deploy of the application
or
2. More complicated option, might be to somehow modify the bytecode of the class A, for example append as last line of default constructor of class A code that will set the attribute SomeService someService to the value that service in my subsystem created for this deployment.
Option 2 is far more complicated and interesting to me, as from my naive thinking this might be similar even to how weld is implemented, find all annotated classes, and modify the their bytecode to inject correct values when they are instantiated, combined with wildfly subsystem and deployers.
Regards,
Dejan