zoukankan      html  css  js  c++  java
  • spring-boot下mybatis的配置

    问题描述:spring boot项目想添加mybatis的配置,在src/main/resources目录下新建了mybatis-config.xml文件,在application.properties文件中添加:

    mybatis.config-location=classpath:mybatis-config.xml
    

    本地启动没有问题,但是使用jenkins构建打包后总是报错:

    [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.FileNotFoundException: class path resource [mybatis-config.xml] cannot be opened because it does not exist
    

    找不到mybatis-config.xml的配置文件。kenjins构建使用的是maven打包,于是找到pom文件,发现没有指定xml文件的位置。改动后为:

    <resources>
    	<resource>
    		<directory>src/main/java</directory>
    	</resource>
    	<!--指定资源的位置 -->
    	<resource>
    		<directory>src/main/resources</directory>
    		<includes>
    			<include>**/*.xml</include>
    			<include>**.properties</include>
    		</includes>
    	</resource>
    </resources>
    

    转载于:https://my.oschina.net/wuyiyi/blog/2885638

  • 相关阅读:
    健壮性与可靠性
    invoke与call
    协变性和逆变性
    枚举类型和位标记
    MacOs mysql 安装
    scp -本地文件上传服务器,指定端口
    java中的无穷大和无穷小
    calendar类-时间处理类
    linux 下ln命令--笔记
    hdfs 文件系统命令操作
  • 原文地址:https://www.cnblogs.com/twodog/p/12135581.html
Copyright © 2011-2022 走看看