
yml文件配置别名不生效(无法解析):Inspection info:Under construction
在mapper.xmlinfotextkey>文件里,我们可能需要用到别名,需要在yml进行配置:
mybatis: mapper-locations: classpath:mapper/*.xml //xml所在位置路径 type-aliases-package: com.jinqiao.user.domain //实体类路径 configuration: map-underscore-to-camel-case: true按道理配置成功,但是没有生效! 原因可能是,是我们之前用过一个插件:mybatis-plugn 我们可以关闭这个插件,然后重启,就能使别名生效了!
成功生效! 第二种方式是:如果你不想关闭mybatis-plugn插件,可以新建一个config.xml文件: 在resources目录下: config.xml里配置别名:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis//DTD Config 3.0//EN" "mybatis/dtd/mybatis-3-config.dtd"> <configuration> <typeAliases> <!-- 指定一个包名,MyBatis会在包名下搜索需要的JavaBean--> <package name="com.jinqiao.user.domain"/> </typeAliases> </configuration>方式二yml里的配置也是方式一的写法,不要删除!(不然后面可能出一些问题) mybatis: mapper-locations: classpath:mapper/*.xml type-aliases-package: com.jinqiao.user.domain configuration: map-underscore-to-camel-case: true
别名同样生效了! 这就是我的解决办法,希望对大家有用,谢谢
👁️ 阅读量:0
© 版权声明:本文《yml文件配置别名不生效(无法解析):Inspection info:Under construction》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686508983a274501.html。