spring-boot, tomcat and java modules

Viewed 362

I have migrated my OSS project (https://m-m-m.github.io) entirely to JPMS (modules). However, integrating with spring-boot now gives me really hard times. First of all I stumbled over various issues with slf4j module support:

But now I am entirely stuck with errors like:

[ERROR] error: the unnamed module reads package javax.servlet from both org.apache.tomcat.embed.core and java.servlet

Inside my modules, I am forced to require the code I am using and cannot access code from classpath/unnamed modules. Hence, I was forced to use modularized versions of servlet-api and slf4j. However, spring-boot uses tomcat-embed and that contains servlet-api but is not using the official JPMS module from JakartaEE. I even tried to update to tomcat 10.0.0-M4 but this is not supported by spring-boot yet:

NoSuchMethodError: 'void org.apache.catalina.Context.addServletContainerInitializer(javax.servlet.ServletContainerInitializer, java.util.Set)'

Is there any magic trick left to get things like this solved? Or is the JPMS a closed shop and as the Java ecosystem is not moving fast enough for years (java9 was released 2017) I am more or less forced to reinvent the wheel and replace all such stuff with modularized code?

0 Answers
Related