5.6
同时使用mp和mybatis,我的type-aliases-package失效了
mybatis:
#mapper配置文件
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.sky.entity
configuration:
#开启驼峰命名
map-underscore-to-camel-case: true
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
id-type: auto
我的mybatis与plus是这样配置的
当我使用别名配置的时候,我发现他居然报错说找不到那个类而导致启动失败
<update id="mUpdate" parameterType="Employee">
后来查阅资料都没有解决,偶然见我想到了我还有mp,于是我把mp也加上了type-aliases-package,一下就好了,后面我问chat
chat回答:需要注意的是,MyBatis-Plus 会自动适配 MyBatis 的配置,因此在很多情况下,你可能只需要配置 MyBatis-Plus 的一些特定选项,而不需要重复配置 MyBatis 的通用选项。
现在回头再想想,我在mapper里明确写了
public interface EmployeeMapper extends BaseMapper<Employee>
他就是使用的mp,而mp兼容使用mybatis

浙公网安备 33010602011771号