The difference between @Mapper and @Repository annotations in Mybatis

The difference between these two annotations is

1. @MapperAfter use , there is no need to set the scan address in the spring configuration. Through the namespace attribute in mapper.xml corresponding to the relevant mapper class, spring will dynamically generate the Bean and inject it into the ServiceImpl.

2. @RepositoryYou need to configure the scan package address in Spring, and then generate the dao layer bean, which is then injected into the ServiceImpl

Guess you like

Origin blog.csdn.net/y1534414425/article/details/108979941