Springboot Integration MyBatis Error: Consider defining a bean of type ' xx.xx.xx ' in your Configur

Source: Internet
Author: User

Springboot and MyBatis After integration, if you follow spring's consolidation habits, you may find an error:

Application FAILED to START ***************************

Description:

Field Entfiledao in Com.alibaba.serviceImpl.EntFileServiceImpl required a bean of type ' com.alibaba.dao.EntFileDao ' that Could not being found.

Action:

Consider defining a bean of type ' Com.alibaba.dao.EntFileDao ' in your configuration.

This was due to the fact that the springboot was not scanned to Com.alibaba.dao.EntFileDao when it started, and @autowired was used in Com.alibaba.serviceImpl.EntFileServiceImpl. Private Enfiledao Entfiledao are assembled, so errors are found and said to be undefined. At this point, you need to add an annotation on the Springboot startup class: @MapperScan ("Persistent layer path"), which will scan to Com.alibaba.dao.EntFileDao.

Complete integration steps can be consulted: Spring Boot---(8) springboot integrated MyBatis

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.