JAVA入门大坑:expected at least 1 bean which qualifies as autowire candidate. Dependency annotations

这篇具有很好参考价值的文章主要介绍了JAVA入门大坑:expected at least 1 bean which qualifies as autowire candidate. Dependency annotations。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helloWord': Unsatisfied dependency expressed through field 'testMapper': Error creating bean with name 'testMapperImpl': Unsatisfied dependency expressed through field 'testDao': No qualifying bean of type 'com.example.myspringboot.Dao.TestDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Description:

Field testDao in com.example.myspringboot.Service.TestMapperImpl required a bean of type 'com.example.myspringboot.Dao.TestDao' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.example.myspringboot.Dao.TestDao' in your configuration.

不要用这个注释:

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

只用:

@SpringBootApplication

//@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
//@MapperScan()
@SpringBootApplication
//@EnableScheduling
public class MySpringBootApplication {
    public static void main(String[] args) {
        SpringApplication.run(MySpringBootApplication.class, args);
    }
}

dao层无法注入service文章来源地址https://www.toymoban.com/news/detail-553973.html

到了这里,关于JAVA入门大坑:expected at least 1 bean which qualifies as autowire candidate. Dependency annotations的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

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

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

相关文章

  • springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type ‘x‘ available

    今天在执行 quartz 定时任务时,报出如下错误: 发现这个错误: No qualifying bean of type \\\'com.xxx.CollectionTaskServiceImpl\\\' available 。 我们继续看错误,错误发生在 SpringApplicationContext.getBean 的方法中。 结合 No qualifying bean of type \\\'com.xxx.CollectionTaskServiceImpl\\\' available 错误可知, SpringApplica

    2024年02月04日
    浏览(33)
  • 解决:No qualifying bean of type ‘org.springframework.web.client.RestTemplate‘ available:

    SpringBoot 项目启动时报错:  No qualifying bean of type \\\'org.springframework.web.client.RestTemplate\\\' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}     产生原因 :由于springboot版本问题,当前项目的版本需要

    2024年02月04日
    浏览(33)
  • No qualifying bean of type ‘org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate‘ a

    No qualifying bean of type ‘org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 提示找不到 ElasticsearchRestTemplate 写一个配置类注入

    2024年02月17日
    浏览(36)
  • 云服务部署kafka 报错:“docker run“ requires at least 1 argument.

    创建kafka我们需要分两步走: 前沿:请大家注意在云服务器上部署任何新的服务一定要注意在对应云安全配置上开放此端口号   1、使用docker 先拉取 zookeeper,因为kafka对zookeeper是强依赖 命令:docker pull zookeeper:3.4.14 创建容器指令:docker run -d --name zookeeper -p 2181:2181 zookeeper:3.

    2024年02月08日
    浏览(35)
  • mmdetection ValueError: need at least one array to concatenate解决方案

    在mmdetection中有时候训练模型会出现ValueError: need at least one array to concatenate的错误,详情如下图所示。 很多人都说是mmdet/dataset下coco.py或voc.py中CLASSES设置与数据集对应不上,博主不以为然。因为在mmdetection2中,不需要到mmdet/dataset中修改CLASSES,只需要在训练配置文件中中设置一

    2023年04月11日
    浏览(39)
  • You must install at least one postgresql-client-<version> package

    使用主机上的映射端口来连接到 PostgreSQL 数据库。例如,使用以下命令连接到数据库: 出现下面的问题: 分析: 如果您在运行 psql 命令时遇到错误消息 You must install at least one postgresql-client-version package ,这意味着您的系统缺少 PostgreSQL 客户端工具。 要解决这个问题,您需要

    2024年02月10日
    浏览(27)
  • 项目依赖问题导致No qualifying bean of type 'org.apache.ibatis.session.SqlSessionFactory' available: more tha...

    A项目之前一直都是好好的,但是某天下午启动的时候报错,报错见下,报错原因是org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type \\\'org.apache.ibatis.session.SqlSessionFactory\\\' available: more than one \\\'primary\\\' bean found among candidates。  初步定位这个问题的时候眼睛一直

    2023年04月09日
    浏览(28)
  • SparkException: Dynamic partition strict mode requires at least one static partition column

    创建表后却无法写入数据? 报错内容:== Exception in thread “main” org.apache.spark.SparkException: Dynamic partition strict mode requires at least one static partition column. To turn this off set hive.exec.dynamic.partition.mode=nonstrict at org.apache.spark.sql.hive.execution.InsertIntoHiveTable.processInsert(InsertIntoHiveTable.scala:1

    2024年04月11日
    浏览(44)
  • No variants found for ‘:app‘. Check build files to ensure at least one variant exists. at: 2022.2.1

    Android Studio 2022.2.1项目迁移报错1、No variants found for \\\':app\\\'. Check build files to ensure at least one variant exists. at:,2、manifest merger failed with multiple errors see logs,3、module java.base does not “opens java.io“ to unnamed module。 PS:(2022.2.1)新版AS。。。 1,JDK17 2,AGP8.0,我仅更为7.1+ Android SDK Bui

    2024年02月07日
    浏览(41)
  • At least one <template> or <script> is required in a single file component.

    新建了一个vue3项目引入路由的时候报这个语法错误,检查版本什么都没问题写法也对,看字面意思是解析不了template 没细想就下了一个template解释器 npm i vue-template-compiler 然而无事发生 纠结了一下想起来我引入的一个路由的文件(vue文件)因为新建还没有写html部分也就是个

    2024年02月11日
    浏览(33)

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

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

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

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

二维码1

领取红包

二维码2

领红包