0 Replies Latest reply on Apr 4, 2017 4:52 AM by Stephan Pelikan

    @javax.ws.rs.ext.Provider not used since WildFly 10.1

    Stephan Pelikan Newbie

      Hi,

       

      I have an ear containing

      - a lib folder

        - a jar containing two @javax.ws.rs.ext.Provider annotated classes

      - serveral web modules using jax-rs

       

      The annotated classes look like this:

      @javax.ws.rs.ext.Provider
      @javax.ws.rs.Consumes(MediaType.APPLICATION_JSON)
      public class JacksonJsonDeserializeProvider extends com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider {
      
          @PostConstruct
          public void initialize() {
      
              ObjectMapper mapper = new ObjectMapper();
      
              mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
      
              // Needed for serializing enums by 'toString()' instead of 'name()'
              // which is used to decouple the name of an enum-entry from the string
              // sent to/received from the client
              mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);
      
              super.setMapper(mapper);
      
          }
      
      }
      
      @javax.ws.rs.Provider
      @javax.ws.rs.Produces(MediaType.APPLICATION_JSON)
      public class JacksonJsonSerializeProvider extends com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider {
      
          @Inject
          private CapProperties capProperties;
      
          @PostConstruct
          public void initialize() {
      
              ObjectMapper mapper = new ObjectMapper();
      
              mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
              mapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING, true);
      
              final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
      
              TimeZone timeZone = TimeZone.getTimeZone(capProperties.timezone());
              simpleDateFormat.setTimeZone(timeZone);
      
              mapper.setDateFormat(simpleDateFormat);
      
              super.setMapper(mapper);
      
          }
      
      }
      

       

      Once I access a JAX-RS API which are part of those web modules the Provider classes are found and initialize() is called and Json serializing/deserializing can be configured in this way.

       

      This works great using WildFly10.0. Since WildFly10.1 the class is found and the initialize() method is called but it does not effect Json serializing/deserializing any more. I also tried using the file "META-INF/services/javax.ws.rs.ext.Providers" pointing to this Provider classes but it didn't work either.

       

      Has anyone an idea what changed from WildFly10.0 to WildFly10.1 to break this feature?

      Or has anyone a working example using WildFly10.1?

       

      Thanks,

      Stephan