Reprinted from http://blog.csdn.net/xlxxybz1314/article/details/51404700
In development, I added the mapper scanner to the Applicationcontext-dao.xml.
[HTML]View PlainCopy
- <!--mapper Scanner--
- <Bean class="Org.mybatis.spring.mapper.MapperScannerConfigurer">
- <!--Scan package path, if you need to scan multiple packages, use half-width comma-separated-
- <property name= "basepackage" value="Com.qianlv.ssmdemo.mapper" />
- <!--This is not sqlsessionfactory because if you use the datasource that will cause the above configuration to fail--
- <property name= "sqlsessionfactorybeanname" value="sqlsessionfactory" />
- </Bean>
However, injecting mapper in the editing of a service will prompt could not autowire, but can be performed normally.
[Java]View PlainCopy
- Public class Itemsserviceimpl implements com.qianlv.ssmdemo.service.itemsservice{
- @Autowired
- Itemsmappercustom Itemsmappercustom;
- Public list<itemscustom> finditemslist (Itemsqueryvo itemsqueryvo) throws Exception {
- return Itemsmappercustom.finditemslist (ITEMSQUERYVO);
- }
- }
We need to change the setup of idea.
Change the rightmost serverity to warning
Spring Annotated mode idea could not autowire,eclipse but no problem