Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field(淘淘商城)

我在练习淘淘商城时,在整合完框架时,使用了dubbo服务框架来运行项目报错以上错误。这种错误一般都是因为我们的配置文件有问题,所以检查是否少写了<context:component-scan base-package="com.taotao.service"></context:component-scan>,或者是包路径有问题,或者没有在service实现类上添加@Service。

然而我今天出现的错误不是上述原因,保存信息还搭配了Caused by: java.lang.ClassNotFoundException: org.I0Itec.zkclient.exception.ZkNoNodeException。  这是因为我的粗心,在配置web项目的pom文件时,短了2个依赖,添加上就好了。依赖如下:

<dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
    </dependency>
    <dependency>
        <groupId>com.github.sgroschupf</groupId>
        <artifactId>zkclient</artifactId>
    </dependency>

猜你喜欢

转载自blog.csdn.net/qq_34731859/article/details/85862605