软件编程
位置:首页>> 软件编程>> java编程>> springboot 2.0 mybatis mapper-locations扫描多个路径的实现

springboot 2.0 mybatis mapper-locations扫描多个路径的实现

作者:躁动的青年  发布时间:2023-07-12 02:30:53 

标签:mybatis,mapper,locations,路径

springboot 2.0 mybatis mapper-locations扫描多个路径

mapper-locations扫描多个路径,中间以,分开,

如果mapper.xml在源码包下,配置成classpath*开头比较好使


mybatis:
 mapper-locations: classpath*:mapper/*.xml,classpath*:com/urthink/upfs/**/*Mapper.xml
 type-aliases-package: com.urthink.upfs.springbootmybatis.entity
 #IDENTITY: MYSQL #取回主键的方式
 #notEmpty: false #insert和update中,是否判断字符串类型!=''
 configuration:
   #进行自动映射时,数据以下划线命名,如数据库返回的"order_address"命名字段是否映射为class的"orderAddress"字段。默认为false
   map-underscore-to-camel-case: true
   # 输出SQL执行语句 (log4j2本身可以输出sql语句)
   #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #这种带结果集

maven 打包源码包下的资源文件,如xml


 <build>
       <resources>
           <resource>
               <directory>src/main/resources</directory>
               <!-- <excludes>
                   <exclude>**/*.properties</exclude>
                   <exclude>**/*.xml</exclude>
               </excludes> -->
               <includes>
                   <include>**/*.properties</include>
                   <include>**/*.xml</include>
                   <include>**/*.yml</include>
               </includes>
               <filtering>false</filtering>
           </resource>
           <resource>
               <directory>src/main/java</directory>
               <includes>
                   <include>**/*.xml</include>
               </includes>
               <filtering>false</filtering>
           </resource>
       </resources>
   </build>

来源:https://blog.csdn.net/haveqing/article/details/86624055

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com