Spring Boot Integrated MyBatis error

Source: Internet
Author: User

caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying Bean of type [ So.dian.dev.device.interfaces.IDeviceInfoSV] is defined:expected single matching beans but found 2:deviceinfosvimpl, IDEVICEINFOSV At org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency ( defaultlistablebeanfactory.java:1126) At org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency ( defaultlistablebeanfactory.java:1014) At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredfieldelement.inject (autowiredannotationbeanpostprocessor.java:545) ... more first of all, my engineering structure: Controller-->manager-->sv-->daoIt can be seen that the above exception is because the MyBatis automatic scanning to the SV layer interface, MyBatis will take this SV interface and mapper to match, and Mapper is configured in the DAO layer<mapper namespace="So.dian.dev.dao.device.IDeviceInfoDAO"> So of course I can't find it. The solution is to not let him sweep to the SV layer interface, using the @MapperScan ("So.dian.dev.dao") This annotation @SpringBootApplication@PropertySource({"variables.properties","Resource.local.properties"}) @MapperScan("So.dian.dev.dao") @EnableCachingpublic Class application extends springbootservletinitializer{

Spring Boot Integrated MyBatis error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.