How to configure javax-to-jakarta transformation in spring boot 3 embedded tomcat?
Asked Answered
E

1

1

Using Spring boot 3.0.10 application with third party libraries like opwnws, opensaml which use javax packages. These libraries haven't releases their jakarta versions so runtime transformation from javax to jakarta is needed.

In standalone tomcat, we have option to transform javax classes to jakarta classes during runtime using jakartaConverter="TOMCAT" property in context.xml file. It transforms javax to jakarta during runtime.

Finding similar configuration for spring boot 3 embedded tomcat.

Tried to configure TomcatContextCustomizer with webapploader customized with Jakarta Converter.

But during runtime, third party library is using ClassLoaders$AppLoader of jdk which is parent class loader of webapploader class, so transformation doesn't take place. Also tried by setting parent class loader of webapploader as customized converter class, but nothing works.

Is there any way to make spring boot 3 tomcat to perform javax to jakarta migration during runtime ?

Elfland answered 29/5 at 13:55 Comment(2)
as per spring boot community, jakarta transformation during runtime is not possible for spring boot application. eclipse transformer plugin had to be applied on application package (jar or war) to apply jakarta transformation on package building. (github.com/spring-projects/spring-boot/issues/40995) However, eclipse-transformer is not working for spring boot application archive, so had to create new custom plugin (github.com/chirag519086/jakarta-transformer-plugin) which is transforming javax classes to jakarta in spring boot app jar and it's all dependencies.Elfland
Can you write this information as "answer"?Idolatrize
E
1

As per spring boot community, jakarta transformation during runtime is not possible for spring boot application. eclipse transformer plugin has to be applied on application package (jar or war) to apply jakarta transformation on package building. (github.com/spring-projects/spring-boot/issues/40995)

However, eclipse-transformer plugin is not working for spring boot application archive (Spring boot uber jar), so had to create new custom plugin (github.com/chirag519086/jakarta-transformer-plugin) which is transforming javax classes to jakarta in spring boot app uber jar and it's all packaged dependency jars.

Elfland answered 26/6 at 5:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.