]
George Gastaldi closed FORGE-1876.
----------------------------------
Assignee: George Gastaldi
Fix Version/s: 2.6.1.Final
(was: 2.x Future)
Resolution: Done
Addon services should be exposed through @Produces methods
-----------------------------------------------------------
Key: FORGE-1876
URL:
https://issues.jboss.org/browse/FORGE-1876
Project: Forge
Issue Type: Enhancement
Components: Furnace CDI
Affects Versions: 2.6.0.Final
Reporter: George Gastaldi
Assignee: George Gastaldi
Fix For: 2.6.1.Final
Having an addon that depends on the furnace-cdi container and declares the following
class:
{code}
import javax.enterprise.inject.Produces;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
public class RestClientProducer
{
@Produces
public ClientBuilder createClientBuilder()
{
ClientBuilder builder = ClientBuilder.newBuilder();
return builder;
}
@Produces
public Client createClient(ClientBuilder builder)
{
return builder.build();
}
}
{code}
Then:
- {{WeldServiceRegistry.hasService(javax.ws.rs.client.Client.class)}} should return true
- {{AddonRegistry.getServices(javax.ws.rs.client.Client.class).get()}} should call the
producer method and return the requested service