Error creating bean with name “‘‘: Unsatisfied dependency expressed through field““

时间:2025-03-18 09:26:27

问题就是不能创建bean,因为这个bean的一个依赖不行,这里我使用的注解
分析原因:扫描包的位置正确,在配置bean可以,说明还是注解问题,找了很多。发现spring监听器错误。
这是正确的,我也不知道当时咋弄了个错的,找了很久的错误,当一个错误很久没解决,一定要从头走一遍流程。

    <!-- 定义SPRING监听器,加载spring -->
<listener>
  <listener-class>
  org.springframework.web.context.ContextLoaderListener
  </listener-class>
</listener>