I think one of the reasons for having the sling wrapper is the overlay
of jakarta.json.spi.JsonProvider, notably redefining the provider()
method to always return a singleton instance of johnzon, see [0].

In the original JsonProvider class[1], the same method always creates
a new JsonProvider instance, and it always performs a ServiceLoader
load, which leads to zip/jar files getting inspected. The only way
around the ServiceLoader lookup is setting a system property, and then
a new instance is still created with each invocation.

Thus, the Sling wrapper offers a significant performance improvement,
and it also prevents another implementation from silently sneaking in.

Regards
Julian

[0] 
https://github.com/apache/sling-org-apache-sling-commons-johnzon/blob/df8fb26f511b2ea70b336b74fad808fe8afbfe2c/src/main/java/jakarta/json/spi/JsonProvider.java#L63-L65
[1] 
https://github.com/jakartaee/jsonp-api/blob/a6b932f31d996178ff0fd4604b1b35819297a116/api/src/main/java/jakarta/json/spi/JsonProvider.java#L107-L141

On Fri, 6 Nov 2026 at 09:58, Carsten Ziegeler via dev
<[email protected]> wrote:
>
> True, although I am not a huge fan is SPIFly and the complexity it adds
> just to get services wired
>
> Regards
> Carsten
>
> On 11/6/2026 9:52 AM, Stefan Seifert via dev wrote:
> > sound good to me - it will be a great benefit to get rid of that wrapper 
> > bundle, and being able to freely update the dependency if a new johnzon 
> > version is published.
> >
> > stefan
> >
> >> -----Original Message-----
> >> From: Konrad Windszus via dev <[email protected]>
> >> Sent: Wednesday, November 4, 2026 11:34 AM
> >> To: [email protected]
> >> Cc: Konrad Windszus <[email protected]>
> >> Subject: Deprecate Sling Commons Johnson
> >>
> >> Hi,
> >> Recent versions of Apache Johnson support OSGi with proper metadata for
> >> OSGi Service Loader Mediator
> >> (https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.loader.html),
> >> compare with https://issues.apache.org/jira/browse/JOHNZON-108.
> >> Although this requires deployment of SPI Fly
> >> (https://aries.apache.org/documentation/modules/spi-fly.html) this is also
> >> required by SLF4J 2.x (which is leveraging service loader as well).
> >>
> >> Maintaining our own wrapper (https://github.com/apache/sling-org-apache-
> >> sling-commons-johnzon) is therefore no longer necessary.
> >> Sling Starter already ships with SPIFly and most other distributions I
> >> know do as well meanwhile.
> >> Any concerns with deprecating it following the procedure from
> >> https://sling.apache.org/documentation/development/deprecating-sling-
> >> modules.html and replace its usage in Sling Starter by Apache Johnson
> >> directly (https://github.com/apache/sling-org-apache-sling-
> >> starter/blob/64a72a361c09333ea423ebafbea01cb1418c83fe/src/main/features/bo
> >> ot.json#L84)?
> >>
> >> Thanks for your input,
> >> Konrad
>
> --
> Carsten Ziegeler
> Adobe
> [email protected]
>

Reply via email to