You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
The JerseyWebApplicationInitializer always gets loaded, setting a ServletContext initParameter contextConfigLocation to a value which breaks another WebApplicationInitalizer which already has a value for configLocation.
Details
Hi, I'm trying to incorporate springdoc (swagger / openapi docs) in our spring application, the console of the Frank!Framework. This console is a spring boot application which is bootstrapped when starting the framework.
Springdoc introduces the spring-boot-autoconfigure dependency to our application. When spring-boot-autoconfigure is present, it will load org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration.JerseyWebApplicationInitializer, defined in the JerseyAutoConfiguration. Jersey is not present, so this auto configuration won't be loaded. But, this inner static class doesn't have a @ConditionalOn* annotation which makes sure it gets loaded (in our application), setting the contextConfigLocation initParameter to <NONE> in the servletContext. This results in overriding the context config location of our WebApplicationInitializer, which in turn makes sure our application doesn't start anymore, see the attached stacktrace. The error is: Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/<NONE>].
If I debug and make sure this <NONE> init parameter is set to 'null' in org.springframework.web.context.ContextLoader#configureAndRefreshWebApplicationContext, so it isn't overriding the configLocation of the webapplicationContext, our application starts like I would expect.
I can't seem to override this init parameter (you can only set this to a non-null value or check if the value is set). I think that Conditional loading of the JerseyWebApplicationInitializer will fix this issue. Other static inner classes use conditional loading in that file as well, for instance the JacksonResourceConfigCustomizer right below it.
I've discussed this with a few other contributors to our framework and we all think that this JerseyWebApplicationInitializer shouldn't be loaded. We are using spring boot 3.4.4.
The text was updated successfully, but these errors were encountered:
Thanks for the report. Unfortunately, we can't use conditions here as it's the servlet container that finds and loads the classes that implement WebApplicationInitializer. It passes them to SpringServletContainerInitializer.onStartup(Set<Class<?>>, ServletContext) which then creates an instance of each class, orders them, and calls them. Instead, I think we can update JerseyWebApplicationInitializer to only set the init parameter when org.glassfish.jersey.server.spring.SpringWebApplicationInitializer is present.
Summary:
The JerseyWebApplicationInitializer always gets loaded, setting a ServletContext initParameter contextConfigLocation to a value which breaks another WebApplicationInitalizer which already has a value for configLocation.
Details
Hi, I'm trying to incorporate springdoc (swagger / openapi docs) in our spring application, the console of the Frank!Framework. This console is a spring boot application which is bootstrapped when starting the framework.
Springdoc introduces the
spring-boot-autoconfigure
dependency to our application. When spring-boot-autoconfigure is present, it will loadorg.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration.JerseyWebApplicationInitializer
, defined in theJerseyAutoConfiguration
. Jersey is not present, so this auto configuration won't be loaded. But, this inner static class doesn't have a@ConditionalOn*
annotation which makes sure it gets loaded (in our application), setting the contextConfigLocation initParameter to<NONE>
in the servletContext. This results in overriding the context config location of our WebApplicationInitializer, which in turn makes sure our application doesn't start anymore, see the attached stacktrace. The error is:Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/<NONE>]
.If I debug and make sure this
<NONE>
init parameter is set to 'null' inorg.springframework.web.context.ContextLoader#configureAndRefreshWebApplicationContext
, so it isn't overriding the configLocation of the webapplicationContext, our application starts like I would expect.I can't seem to override this init parameter (you can only set this to a non-null value or check if the value is set). I think that Conditional loading of the
JerseyWebApplicationInitializer
will fix this issue. Other static inner classes use conditional loading in that file as well, for instance theJacksonResourceConfigCustomizer
right below it.I've discussed this with a few other contributors to our framework and we all think that this
JerseyWebApplicationInitializer
shouldn't be loaded. We are using spring boot 3.4.4.The text was updated successfully, but these errors were encountered: