I am having an issue with wildfly 10 when trying to get a custom Transformer bean that will perform the incoming data into the form I need. I declare custom @Provider
@Provider
@Dependent
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class BaseProvider<T extends Base> implements MessageBodyReader<T>, MessageBodyWriter<T> {
@Inject
private ModelTransformer<T, String> modelTransformer;
...
This is the provider. In wildfly I have to specify @Dependent because the class is parametrized (Generics), but in glassfish 4 for e.g. I don't have to do that.
The problem is that the modelTransformer is null. I don't get any deployment issues, but I get NullPointerException in runtime.
This is the ModelTransformer implementation that I am expecting to be injected.
@Dependent
public class GsonModelTransformerImpl<T extends Base> implements ModelTransformer<T, String> {
private Gson gson;
...// Specific impl of the interface that uses gson to do some stuff
I can't understand what I am doing wrong, but this code works on glassfish 4, and cannot get it working on wildfly 10.
I can give more details, maybe I missed something...
Thanks!