org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createRestApi' defined in class path resource [com/uniware/oa_demo/config/Swagger2Config.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.spring.web.plugins.Docket]: Factory method 'createRestApi' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/http/MediaType
再仓库里面org.springframework下也没找到http.MediaType
然后说是Bean注入失败,我就配了个swageger,代码如下
帮忙看看是什么问题?
spring-web看下这个包有没有,没有加上有的话换下版本
compile ("org.springframework.boot:spring-boot-starter:${springBootVersion}")
compile ("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
compile ("org.springframework.boot:spring-boot-starter-aop:${springBootVersion}")
compile ("org.springframework:spring-context-support:4.3.17.RELEASE")
compile ("com.spring4all:swagger-spring-boot-starter:1.9.0.RELEASE")
我用的这些包,启动正常,上述你说不加web,敢问不加web包,纯后台没有线程的保留,直接就停了,你的swagger也没啥意义啊
org.springframework.boot
spring-boot-starter-web