1. jersey
  2. JERSEY-2518

Disable MBW, MBR, ExceptionMapper automatic registration via META-INF/services


    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.9
    • Component/s: core
    • Labels:


      We should not support automatic registration of providers via meta-inf/services mechanism.

      We'd like to disable automatic lookup and registration of JAX-RS extension providers using META-INF/services mechanism in Jersey 2.x and it's important for us to know your opinions about this before we actually do it. Contracts that would be removed from the SPI discovery by default include MessageBodyReader, MessageBodyWriter and ExceptionMapper.
      Automatic registration via META-INF/services has been introduced in Jersey 1.x to register default MBWs/MBRs required by JAX-RS spec and we've migrated this mechanism into Jersey 2 to make these two versions compatible in this regard. Jersey 2.x however takes a different approach to register default providers required by JAX-RS. The reason for the proposed removal is to make co-existence of Jersey 1 (Client) and Jersey 2 libraries on the same class-path possible without these interfering with each other.
      For backward compatibility, we plan to introduce a new module in Jersey 2.x which would enable automatic SPI registration of JAX-RS providers via META-INF/services in case this module is present on an application class-path. Additionally, for popular 3rd party libraries that rely on the old discovery mechanism (currently we are only aware of Jackson 2) we would introduce an integration module that would automatically register the library providers into the client/server runtime when the module is put on a class-path together with the 3rd party library.


        There are no comments yet on this issue.


          • Assignee:
            Michal Gajdos
            Michal Gajdos
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: