fabienrenaud / java-json-benchmark

Performance testing of serialization and deserialization of Java JSON libraries
MIT License
973 stars 134 forks source link

Add META-INF.services for JsonProvider (jsr-374,353) #16

Closed mhyeon-lee closed 6 years ago

mhyeon-lee commented 6 years ago

The libraries that implement JSR-353,374 (javax.json, johnzon) were using GensonJsonProvider. The Genson library has a javax.json.spi.JsonProvider set on META-INF.services, which will return a GensonJsonProvider on the JsonProvider.provider() call. (GensonJsonProvider does not implement JSR-374.)

I added a javax.json.spi.JsonProvider to META-INF.services so that I could select a JsonProvider implementation. The default implementation uses org.glassfish.json.JsonProviderImpl. In case of johnzon, JsonReaderFactory and JsonGeneratorFactory are injected directly into UsersJsonProvider to use johnson's own JsonProvider.

Now, in the benchmark test, the javaxjson() test will use org.glassfish.json.JsonProviderImpl and johnzon() will use org.apache.johnzon.core.JsonProviderImpl.

fabienrenaud commented 6 years ago

Manually merged. Had to revert the revert to re-introduce yasson and fix UsersJsonProvider.