This is similar to #1065. The problem this time is JerseyAutoConfiguration. It's annotated with @ConditionalOnClass({SpringComponentProvider.class, ServletRegistration.class}). Normally, this wouldn't be a problem as, in the absence of either of those classes, the configuration class bean will not be present in the bean factory and, therefore, its annotations will never be introspected using reflection.
However, JerseyAutoConfiguration is a WebApplicationInitializer. This means that when it's deployed to a standalone container, JerseyAutoConfiguration is found by the container and its class is passed to SpringServletContainerInitializer. SpringServletContainerInitializer introspects every WebApplicationInitializer class so that it can order them. This blows up if Jersey's SpringComponentProvider class isn't on the classpath as the annotation is referencing SpringComponentProvider as a Class and the attempt to load it fails. The problem can be avoided by referencing SpringComponentProvider using a String.
TL;DR: Using @ConditionalOnClass on a WebApplicationInitializer is risky. For it to be safe, the class must be referenced as a String rather than a Class.
Read full article from ArrayStoreException when using spring-boot-1.2.0.M2 on Wildfly 8.1.0 · Issue #1696 · spring-projects/spring-boot
No comments:
Post a Comment