I am updating an application from pre-historic Quarkus 1.2 to modern 1.11.1
This app has a requirement to respond to the HTTP header Content-Type for "text/csv" using the CSV format.
In order to achieve CSV in Quarkus 1.2, we had added a new Jax-RS Provider. The way to do that in 1.2 was to add an entry with the class name in the file META-INF/services/javax.ws.rs.ext.Providers.
Back in 1.2, I was surprised about this file, because I expected it to be similar to the
Java ServiceLoader mechanism ; that is, the class implements the interface with the same name of the file. In this case, the file has the name javax.ws.rs.ext.Providers, so the class should implement this interface.
But no. To make it work in Quarkus 1.2, the class implements the interface javax.ws.rs.ext.MessageBodyWriter instead.
Fast forward to Quarkus 1.11.1, and the file in META-INF/services is no longer needed. I can simply annotate the class with @javax.ws.rs.ext.Provider and it is discovered at runtime.
My questions:
- Are files in directory META-INF/services regarded? When is it scanned by the runtime?
- What about annotation @Provider? Is there a spec on how to use it, and does Quarkus deviate from that?
Thanks and regards,