Wonderful problem: Spring+mybaits Project suddenly appeared some of the mapper classes could not find

Source: Internet
Author: User

First, the problem phenomenon

1,no Bean named ' bommanagemapper ' found in Org.s[email protected] ...

2, I commented out all the references in the code Bommanagemapper, and another mapper object could not be found

3, but oddly, there are two items that are used to start the Mapper object can be found, found that the two Mapper objects are under the project's core package, and other mapper objects cannot be found under the interfaces package;

Second, find the answer

1, the suspicion is yesterday modified what things, resulting in this problem (specifically also remember not clear, so version control is really important, and do a good job is to submit every day);

2, try to restore yesterday's changes, delete some new content, but the problem is still;

Just so tossing the whole morning;

Third, the settlement

Open the spring configuration file to see, there is this line, scan the Mapper and DAO classes:

    <class= "Org.mybatis.spring.mapper.MapperScannerConfigurer"    P: Basepackage= "Com.skysport.*.dao"  p:sqlsessionfactorybeanname= "Sqlsessionfactory"  />

It is this DAO, suddenly thought, yesterday put interfaces in the package of the ' DAO ' folder renamed to ' Mapper ', and the core package or DAO package, OK, the problem reason found.

Rename the DAO package in the core package as Mapper package, restart the service and return to normal;

41-Point thinking:

1, about positioning problems:

If you have not appeared before, but have done some changes after the problem, then it must be the modification of the action caused.

2, about version control:

Develop the habit of submitting code on a daily basis, so that you can compare the contents of each day to make it easier to locate the problem;

3, about modification:

When modifying a piece of content, it is important to assess how much impact it has, and I think it can be measured from two angles:

A), quantifiable: Modify a content, if directly affect a lot of file modification, then must be careful, to assess the risk (for example: whether each involved in the place has been modified)

b), not quantifiable: for example, modify the code lock mechanism, may affect on one or two classes, then rely on the developer's own ability and enough testing to avoid risk.

Wonderful problem: Spring+mybaits Project suddenly appeared some of the mapper classes could not find

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.