Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot Auto Configuration not usable in WebFlux project #154

Closed
jrehwaldt opened this issue Aug 17, 2018 · 4 comments · Fixed by #155
Closed

Spring Boot Auto Configuration not usable in WebFlux project #154

jrehwaldt opened this issue Aug 17, 2018 · 4 comments · Fixed by #155
Assignees
Labels

Comments

@jrehwaldt
Copy link
Contributor

Currently, when including org.zalando:tracer-spring-boot-starter into Spring 5 reactive applications Spring cannot start (NoClassDefFoundError: javax/servlet/Filter) because of TracerAutoConfiguration's hard dependency on javax.servlet.Filter.

Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.zalando.tracer.spring.TracerAutoConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659)
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556)
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:541)
	at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:599)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:726)
        ....
Caused by: java.lang.NoClassDefFoundError: javax/servlet/Filter

Expected Behavior

The application should start, but disable servlet filtering. All other configurations should be preserved.

Actual Behavior

It fails.

Possible Fix

Extract TracerFilterAutoConfiguration into separate class and add @ConditionalOnWebApplication there.

@whiskeysierra
Copy link
Contributor

Thanks for reporting! Your proposal would fix it, but we wouldn't have proper support for Spring WebFlux afterwards. We have a similar discussion in zalando/logbook#331.

@whiskeysierra whiskeysierra self-assigned this Aug 17, 2018
@jrehwaldt
Copy link
Contributor Author

jrehwaldt commented Aug 17, 2018

I know. But at least all other configuration properties such as MDCListener, AspectJ, ... etc would work as expected. All else might or might not be added in the future.

@whiskeysierra
Copy link
Contributor

Yes, makes sense. Would you be willing to open a pull request by any chance?

@jrehwaldt
Copy link
Contributor Author

I'll have a look next week.

lukasniemeier-zalando pushed a commit to lukasniemeier-zalando/tracer that referenced this issue Jul 13, 2019
…er-only-for-mvc

Configure TracerFilter only in Spring MVC environments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants