1. 程式人生 > >Caused by: java.lang.ClassNotFoundException: springfox.documentation.schema.ModelReference 錯誤解決

Caused by: java.lang.ClassNotFoundException: springfox.documentation.schema.ModelReference 錯誤解決

造成這種錯誤的原因是父類的pom中<dependecies></dependecies>有springfox的依賴,在這裡面的依賴是的所有工程都必須繼承這個,因此會導致不需要這個或說沒有用到swagger註解的工程,在執行導致上面的類找不到的錯誤。

解決方法, 是將這個springfox移除<dependecies></dependecies> 放入    <dependencyManagement>    </dependencyManagement>讓需要它進行宣告繼承和使用。

<dependencies>和<dependencyManagement>作用和區別見

https://blog.csdn.net/liutengteng130/article/details/46991829

這個連結的文章說明。