国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

No qualifying bean of type ‘org.springframework.transaction.TransactionManager‘ available: expected

這篇具有很好參考價值的文章主要介紹了No qualifying bean of type ‘org.springframework.transaction.TransactionManager‘ available: expected。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

報錯信息

Spring Boot 啟動報錯:

No qualifying bean of type 'org.springframework.transaction.TransactionManager' available: expected single matching bean but found 2: transactionManager,mongoTransactionManager

報錯信息顯示:沒有可注入的TransactionManager,因為要求此事物管理器應該是一個,但是發(fā)現(xiàn)了兩個,容器不知道應該注入哪個,存在的兩個容器分別是:transactionManager、mongoTransactionManager

解決辦法

方法一:Primary

查找項目內bean名稱為:transactionManager、mongoTransactionManager的bean,使用 @Primary標注此bean,意思為這個bean是主要的

方法二:排除:exclude

使用 exclude 排除掉不需要的bean
例如:@SpringBootApplication(exclude = MongoAutoConfiguration.class)

方法三:重命名:Qualifier

使用@Qualifier 標注這兩個bean,將這兩個bean進行重命名,以防止沖突文章來源地址http://www.zghlxwxcb.cn/news/detail-769448.html

到了這里,關于No qualifying bean of type ‘org.springframework.transaction.TransactionManager‘ available: expected的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • 【Spring常見錯誤】No qualifying bean of type

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name \\\'com.ssmpdemo.ServiceTest\\\': Unsatisfied dependency expressed through field \\\'userService\\\'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type \\\'com.ssmpdemo.service.UserService\\\' available: expected at leas

    2023年04月08日
    瀏覽(19)
  • Java No qualifying bean of type * available:expected at least * bean which qualifies as autowire問題解決

    org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type \\\'com.xudongbase.user.dubbo.service.userDubboService\\\' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 1、使用@AllArgsContructor注解進行自動裝配時,默認是以@Autowired注解裝配的,但是其中有一

    2024年02月07日
    瀏覽(23)
  • 【錯誤】A component required a bean of type ‘org.springframework.security.config.annotation.ObjectPostPr

    【錯誤】A component required a bean of type ‘org.springframework.security.config.annotation.ObjectPostPr

    Description: A component required a bean of type \\\'org.springframework.security.config.annotation.ObjectPostProcessor\\\' that could not be found. Action: Consider defining a bean of type \\\'org.springframework.security.config.annotation.ObjectPostProcessor\\\' in your configuration. ? 描述: 組件需要“org.springframework.security.configannotation”類型的

    2024年02月13日
    瀏覽(22)
  • mybatis添加分頁配置時報錯 No bean named ‘org.springframework...ConfigurationClassPostProcessor.importRegistry

    場景:在mybatis 添加分頁配置時報錯 現(xiàn)象:No bean named ‘org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry 原因:版本問題 正確版本: com.baomidou mybatis-plus-boot-starter 3.4.0 錯誤版本: com.baomidou mybatis-plus-boot-starter 3.5.3.1 附MybatisPlusConfig 配置文件: package com.examp

    2024年02月13日
    瀏覽(15)
  • Could not autowire. No beans of ‘DiscoveryClient‘ type found.

    Could not autowire. No beans of ‘DiscoveryClient‘ type found.

    一、導錯了包 DiscoveryClient對應有兩個包: org.springframework.cloud.client.discovery.DiscoveryClient; com.netflix.discovery.DiscoveryClient; 目前導入的包是: 改成第一個包,發(fā)現(xiàn)不再報紅了。

    2024年02月11日
    瀏覽(28)
  • 針對mq錯誤org.springframework.messaging.MessagingException: No route info of this topic........

    org.springframework.messaging.MessagingException: No route info of this topic, course-sms-topic See http://rocketmq.apache.org/docs/faq/ for further details.; nested exception is org.apache.rocketmq.client.exception.MQClientException: No route info of this topic, course-sms-topic See http://rocketmq.apache.org/docs/faq/ for further details. ?? ?at org.apa

    2023年04月08日
    瀏覽(16)
  • @Autowired報錯Could not autowire. No beans of ‘XXX‘ type found

    @Autowired報錯Could not autowire. No beans of ‘XXX‘ type found

    ??IDEA中使用 @Autowired 報錯 Could not autowire. No beans of \\\'XXX\\\' type found ,錯誤大致意思為:沒有匹配到類型為XXX的bean。 ??個人覺得,注入 controller 的 service 雖然一般來說我們都是注入一個接口,但是該接口有實現(xiàn)類,并且使用 @Service 進行關聯(lián),所以注入類型應該也可以視為一

    2024年02月07日
    瀏覽(24)
  • idea報錯:Could not autowire. No beans of ‘UserService‘ type found.

    點個關注,必回關 翻譯:無法自動連線。未找到“用戶服務”類型的服務類。 當報錯之后idea會提示錯誤,不過程序的編譯和運行都是沒有問題的(這個錯誤提示不會產(chǎn)生任何印象) 解決方案 解決方案1: Settings - Editor - Inspections - Spring - Spring Core - Code - Autowiring for Bean Class

    2024年02月11日
    瀏覽(22)
  • idea報“Could not autowire. No beans of ‘UserMapper‘ type found. ”錯解決辦法

    idea報“Could not autowire. No beans of ‘UserMapper‘ type found. ”錯解決辦法

    idea具有檢測功能,接口不能直接創(chuàng)建bean的,需要用動態(tài)代理技術來解決。 1.修改idea的配置 1.點擊file,選擇setting 2.搜索inspections,找到Spring 3.找到Spring子目錄下的Springcore 4.在Springcore的子目錄下找到code 5.把seyerity選項改成警告 2.修改代碼 1,@Autowrited改為@Autowrited(required = false)

    2024年02月05日
    瀏覽(24)
  • IDEA提示找不到Mapper接口:Could not autowire.No beans of ‘xxxMapper‘ type found

    IDEA提示找不到Mapper接口:Could not autowire.No beans of ‘xxxMapper‘ type found

    我們可以看到,上面的紅色警告在提示我們,找不到 xxxMaper 這個類型的 bean。 為啥呢? 因為 @Mapper 這個注解是 Mybatis 提供的,而 @Autowried 注解是 Spring 提供的,IDEA能理解 Spring 的上下文,但是卻和 Mybatis 關聯(lián)不上。而且我們可以根據(jù) @Autowried 源碼看到,默認情況下,@Autowri

    2024年02月08日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包