You can encounter the following error:
Caused by: java.lang.NoSuchMethodError: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry.hasMappingForPattern(Ljava/lang/String;)Z
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.addResourceHandlers(WebMvcAutoConfiguration.java:256)
at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.addResourceHandlers(WebMvcConfigurerComposite.java:102)
Using `gradle dependencies` didn't help me much.
It showed the right dependency I expected:
org.springframework:spring-webmvc:4.1.6.RELEASE
It's one of Gradle sub-projects.
It is caused by another sub-project which it depends on.
The sub-project has a dependency having the following transitive dependency:
org.springframework.mobile:spring-mobile-device:1.1.3.RELEASE
And it has the following transitive dependency:
org.springframework:spring-webmvc:3.2.11.RELEASE
So the conflict occurred.
I solved it as follows:
compile("xxx:xxx:1.0.0") {
exclude module: 'spring-mobile-device'
}
But I can't understand why the latest dependency doesn't win.
No comments:
Post a Comment