<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.hua.saf.*" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /> </bean>
在dao里,必须注明@MapperScan
如:
@MapperScan
public interface IUserDao {
/**
* @param userId
* @return
*/
User getUserById(int userId);
}