NoSuchMethodError: org.springframework.plugin.core.PluginRegistry.getPluginOrDefaultFor NoSuchMethodError: org.springframework.plugin.core.PluginRegistry.getPluginOrDefaultFor spring spring

NoSuchMethodError: org.springframework.plugin.core.PluginRegistry.getPluginOrDefaultFor


This error happens when a piece of code has been compiled with a given method signature, but at runtime, another is found.

This usually happens when there's a difference between the version of a dependency used at compile time, and the dependency that is actually provided to the program at runtime.

We just had this error as well with a colleague, and we fixed it by simply changing the spring boot version to 2.2.2.

Not sure what exactly happened, but given the version is a SNAPSHOT, a wild guess would be that the last working version of springfox (working for you and us) was compiled with a Spring boot version inferior to 2.2.2.That boot version had a different method signature for getPluginOrDefaultFor (or possibly the method didn't exist at all).

Your program sees no difference, because the swagger lib's API didn't change, so it seems like nothing changed and there's suddenly an error.But the actual swagger lib's underlying implementation relies on some method from Spring Boot 2.2.2, which it doesn't find in your setup since Boot's version is 2.1.0, and this generates a conflict between what it expects to find and what it actually does.

Anyway, just upgrading your Boot to 2.2.2 should fix it ; possibly downgrading spring-fox to 2.9.2 if you don't need the webflux module- but it seems you do (didn't get the chance to try, because in our case we do need the springfox webflux dependency)