org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component解决

这篇具有很好参考价值的文章主要介绍了org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component解决。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

今天刚刚学了SpringMVC,出现了这个问题,来解决一下。

这个问题就是因为JDK版本和Spring的版本冲突导致的。

我使用的是JDK17,版本比较高,需要相应的包进行支持。

直接上依赖吧。

最终我使用的就是下面两个。使用这两个可以说跑起来没有什么问题,如果更改不适当可能仅仅只能解决我文章标题的问题,接着又出现其它的问题。比如java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet,如果出现这个问题就看看下面那个依赖的问题,改改总能搞定的。

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>5.3.23</version>
</dependency>

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>4.0.1</version>
  <scope>provided</scope>
</dependency>

同样还需要注意的是Tomcat的版本。我使用的是Tomcat9,之前也用过7、8、10,但最终还是选择了9。Tomcat版本最好也多注意一下,说不定什么时候就给你冒出个奇奇怪怪的问题。

然后附上一下相应包的对应版本:

Spring:

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component解决

地址:https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versions

Servlet:

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component解决

地址:https://tomcat.apache.org/whichversion.html

按照上面的图中的版本对应关系更改自己的,最后应该都是能够成功的。如果报错的时候是一些奇奇怪怪的问题,不妨先考虑一下自己的版本有没有问题。

最后再附上一下maven中央仓库的地址,也许能用上。

地址:https://mvnrepository.com/文章来源地址https://www.toymoban.com/news/detail-437002.html

到了这里,关于org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 关于org.springframework.beans.factory.NoSuchBeanDefinitionException

    这个报错可能是因为: 1. spring的xml配置文件Bean中的id和getBean的id不一致 spring的配置文件中: 而程序中 applicationContext.getBean(“studenta”, Student.class)中的是studenta而spring配置文件的id是student,不一致。 2. 是否是忘记加注解了 @Resource或@Autowired都可以(@Resource是jdk自带的) 3.如果

    2024年02月13日
    浏览(49)
  • Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException

    修改为:    解决办法: BookDao层中添加@Mapper, 告诉springboot这是一个mybatis代理接口类型, 快来扫描我!, 由此生成代理对象 原因三:   测试类ModuleSetApplicationTests和引导程序ModuleSetApplication没有在同名包下, 例如下图, ModuleSetApplication类在com.itheima下ModuleSetApplicationTests没有直接在com

    2024年02月11日
    浏览(34)
  • exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException

    原因: Spring Boot异常org.springframework.beans.factory.NoUniqueBeanDefinitionException:没有可用的合格Bean类型:预期匹配单个Bean,但是匹配到了多个,当该bean被自动装配时与Spring Boot应用程序上下文中的两个或多个加载的Bean匹配时,就会发现该异常。 Spring Boot允许从一个接口或抽象类创

    2024年02月09日
    浏览(27)
  • 报错:Caused by org.springframework.beans.factory.BeanCreationException

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’ defined in class path resource [spring/spring-service.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type ‘java.lang.String’ to

    2024年02月13日
    浏览(34)
  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name

    异常日志:[WARNING] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name \\\'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping\\\': Initialization of bean failed; nested exception is org.springframework.beans.fac

    2024年02月02日
    浏览(66)
  • org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean (启动项目报错)

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name \\\'shiroFilter\\\' defined in class path resource [com/cdzn/mhs/config/ShiroConfig.class]: Unsatisfied dependency expressed through method \\\'shiroFilter\\\' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with n

    2024年02月10日
    浏览(36)
  • 异常:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name

    出现这种异常主要是无法创建bean到容器中,主要有以下几种情况: 1.注解没有添加: controller: 注: controller类要加入@RestController注解,@AllArgsConstructor注解视情况而定。 引入了private final IEnterpriseService service,所以需要注入,可以在controller类上加入@AllArgsConstrctor注解修饰。

    2024年02月21日
    浏览(30)
  • 报错org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name...

    刚学SpringBoot,今天启动的时候报错了,长长的一堆报错信息 报错信息大概说的是创建UserController bean出现错误 下面又说创建UserService bean出现错误和UserMapper也出错 于是我百度了一下,都说没加注解,我检查了一下,改加的都加了呀 于是我又分别测试了一下mapper和service 又说报

    2024年02月04日
    浏览(44)
  • Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean wit

    是因为没有扫描到 mapper,在启动类或者配置类中@MapperScan配置包扫描,或者使用@Mapper注解Mapper接口

    2024年02月16日
    浏览(34)
  • 解决报错:@org.springframework.beans.factory.annotation.Autowired(required=true)

    先把问题贴出来: @org.springframework.beans.factory.annotation.Autowired(required=true) 报这个错是因为: @Autowired(required=true):当使用@Autowired注解的时候,其实默认就是@Autowired(required=true),表示注入的时候,该bean必须存在,否则就会注入失败。 ** ** 解决办法:

    2024年02月13日
    浏览(32)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包