SpringMVC整合Mybatis的对象别名设置方式 1.在mybatis_config.xml中Mybatis别名设置?xml version1.0encodingUTF-8?!DOCTYPE configuration PUBLIC-//mybatis.org//DTD Config 3.0//ENhttp://mybatis.org/dtd/mybatis-3-config.dtdconfiguration!--对象命名空间--typeAliasestypeAlias aliasStafftypecom.tongdatech.Staff//typeAliasesspan stylewhite-space:pre/span!--映射map--mappers/mappers/configuration2.还可以在spring-mybatis.xml中配置[html]view plain copy 在CODE上查看代码片派生到我的代码片?xml version1.0encodingUTF-8?beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:txhttp://www.springframework.org/schema/txxmlns:aophttp://www.springframework.org/schema/aopxsi:schemaLocation http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd !--其他配置省略主要看别名配置--bean idsqlSessionFactoryclassorg.mybatis.spring.SqlSessionFactoryBeanproperty namedataSourcerefdataSource/property namedatabaseIdProviderrefdatabaseIdProvider/property namemapperLocationsvalueclasspath*:/mapper/*/oracle/*.xml/!--给映射的类配置别名--!--默认的别名是model类的首字母小写--!--如StaffDeploy实体类。别名为staffDeploy--property nametypeAliasesPackagevaluecom.tongdatech.demo.domain;com.tongdatech.sys.domain;com.tongdatech.hr.domain///这里配置了三个包下的所有类的别名property namepluginslistref beanmyBatisPaginator/ref beannullSqlInterceptor//list/propertyproperty nameconfigurationbeanclassorg.apache.ibatis.session.Configurationproperty nameobjectFactorybeanclasscom.tongdatech.sys.component.mybatis.PageableObjectFactory//property/bean/property/bean/beans在SpringMVC项目中一般都是以第二种为model设置别名。